(function(){Array.prototype.indexOf||(Array.prototype.indexOf=function(a,b){var f=this.length>>>0;b=Number(b)||0;b=0>b?Math.ceil(b):Math.floor(b);for(0>b&&(b+=f);ba.right||b.righta.bottom||b.bottom=d.length)){a=void 0!==a?a*a:1;b=d[0];for(var f=[b],e,g=1,h=d.length;ga&&(f.push(e),b=e)}b!==e&&f.push(e);e=f;d=e.length;b=new ("undefined"!==typeof Uint8Array?Uint8Array:Array)(d);f=0;g=d-1;h=[];l=[];for(b[f]=b[g]=1;g;){var t=0;for(n=f+1;nt){var C=n;t=k}}t>a&&(b[C]=1,h.push(f,C,C,g));g=h.pop();f=h.pop()}for(n=0;nl.length-1?l.length-1:0>k?0:k;if((k>=l.length||0>k)&&n==p)return!1;n=p;t=e(n);return!0};this.getScale=function(){return g*t};this.putScale=function(k){var p=this.putMapLevel;k/=g;var E;for(E=0;Ee.length-1?e.length-1:0>n?0:n;if((n>=e.length||0>n)&&h==t)return!1;h=t;l=a(h);return!0};this.getScale=function(){return b*l};this.putScale=function(n){var t=this.putMapLevel;n/=b;var k;for(k=0;kBa&&(za.x-=Ba=-Ba);0>Da&&(za.y-=Da=-Da);sa[qa].ReloadStatus(za.x,za.y,Ba,Da)}};this.getTiles=function(ka,pa,sa,qa,za){ka=t.ToMapDistX(1);t.ToMapDistY(1);za=0;if(0db&&(db=ca),naZ&&(Z=na));if(ca===na||0>ca&&ca===-na||0T;T+=2){var ba=[{x:+v[T-2],y:+v[T-1]},{x:+v[T],y:+v[T+1]},{x:+v[T+2],y:+v[T+ 3]},{x:+v[T+4],y:+v[T+5]}];N?T?X-4==T?ba[3]={x:+v[0],y:+v[1]}:X-2==T&&(ba[2]={x:+v[0],y:+v[1]},ba[3]={x:+v[2],y:+v[3]}):ba[0]={x:+v[X-2],y:+v[X-1]}:X-4==T?ba[3]=ba[2]:T||(ba[0]={x:+v[T],y:+v[T+1]});P.push(["C",(-ba[0].x+6*ba[1].x+ba[2].x)/6,(-ba[0].y+6*ba[1].y+ba[2].y)/6,(ba[1].x+6*ba[2].x-ba[3].x)/6,(ba[1].y+6*ba[2].y-ba[3].y)/6,ba[2].x,ba[2].y])}return P}function p(v,N,P,T,X,ba,ha,ja,oa){null==oa&&(oa=1);oa=(1oa?0:oa)/2;for(var ma=[-.1252,.1252,-.3678,.3678,-.5873,.5873,-.7699,.7699,-.9041, .9041,-.9816,.9816],ra=[.2491,.2491,.2335,.2335,.2032,.2032,.1601,.1601,.1069,.1069,.0472,.0472],wa=0,Aa=0;12>Aa;Aa++){var Ea=oa*ma[Aa]+oa,ua=Ea*(Ea*(-3*v+9*P-9*X+3*ha)+6*v-12*P+6*X)-3*v+3*P;Ea=Ea*(Ea*(-3*N+9*T-9*ba+3*ja)+6*N-12*T+6*ba)-3*N+3*T;wa+=ra[Aa]*K.sqrt(ua*ua+Ea*Ea)}return oa*wa}function E(v,N,P){v=h._path2curve(v);N=h._path2curve(N);for(var T,X,ba,ha,ja,oa,ma,ra,wa,Aa,Ea=P?0:[],ua=0,Ta=v.length;uaaa(Gb.x-tb.x)?"y":"x",Jb=.001>aa(sb.x-Ja.x)?"y":"x";var ib=tb.x;var vb=tb.y,wb=Gb.x,xb=Gb.y,yb=Ja.x,zb=Ja.y,Ab=sb.x,Bb=sb.y;if(S(ib,wb)S(yb,Ab)||S(vb,xb)S(zb,Bb))ib=void 0;else{var Eb=(ib-wb)*(zb-Bb)-(vb-xb)* (yb-Ab);if(Eb){var Yb=((ib*xb-vb*wb)*(yb-Ab)-(ib-wb)*(yb*Bb-zb*Ab))/Eb;Eb=((ib*xb-vb*wb)*(zb-Bb)-(vb-xb)*(yb*Bb-zb*Ab))/Eb;var Kb=+Yb.toFixed(2),Lb=+Eb.toFixed(2);ib=Kb<+R(ib,wb).toFixed(2)||Kb>+S(ib,wb).toFixed(2)||Kb<+R(yb,Ab).toFixed(2)||Kb>+S(yb,Ab).toFixed(2)||Lb<+R(vb,xb).toFixed(2)||Lb>+S(vb,xb).toFixed(2)||Lb<+R(zb,Bb).toFixed(2)||Lb>+S(zb,Bb).toFixed(2)?void 0:{x:Yb,y:Eb}}else ib=void 0}ib&&Xb[ib.x.toFixed(4)]!=ib.y.toFixed(4)&&(Xb[ib.x.toFixed(4)]=ib.y.toFixed(4),tb=tb.t+aa((ib[Ib]-tb[Ib])/ (Gb[Ib]-tb[Ib]))*(Gb.t-tb.t),Ja=Ja.t+aa((ib[Jb]-Ja[Jb])/(sb[Jb]-Ja[Jb]))*(sb.t-Ja.t),0<=tb&&1.001>=tb&&0<=Ja&&1.001>=Ja&&(Za?Ob++:Ob.push({x:ib.x,y:ib.y,t1:R(tb,1),t2:R(Ja,1)})))}Za=Ob}else Za=Za?0:[];if(P)Ea+=Za;else{eb=0;for(hb=Za.length;ebTa;Ta++){var Ra=((ma*Qa+oa)*Qa+ja)*Qa-Ea;if(aa(Ra)aa(va))break;Qa-=Ra/va}va=0;Ta=1;Qa=Ea;if(QaTa)return Ta;for(;vaRa?va=Qa:Ta=Qa;Qa=(Ta-va)/2+va}return Qa}var ja=3*N,oa=3*(T-N)-ja,ma=1-ja-oa,ra=3*P,wa=3*(X-P)-ra,Aa=1-ra-wa;return function(Ea,ua){Ea=ha(Ea, ua);return((Aa*Ea+wa)*Ea+ra)*Ea}(v,1/(200*ba))}function J(v,N){var P=[],T={};this.ms=N;this.times=1;if(v){for(var X in v)v.hasOwnProperty(X)&&(T[Ba(X)]=v[X],P.push(Ba(X)));P.sort(bb)}this.anim=T;this.top=P[P.length-1];this.percents=P}function C(v,N,P,T,X,ba){P=Ba(P);var ha=v.ms,ja={},oa={},ma={};if(T){var ra=0;for(ua=$a.length;raT*v.top){P=v.percents[ra];var Ta=v.percents[ra-1]||0;ha=ha/v.top*(P-Ta);var Qa=v.percents[ra+1];var Ra=v.anim[P];break}else T&&N.attr(v.anim[v.percents[ra]]);if(Ra){if(Ea)Ea.initstatus=T,Ea.start=new Date-Ea.ms*T;else{for(var va in Ra)if(Ra.hasOwnProperty(va)&&(Pa.hasOwnProperty(va)||N.paper.customAttributes.hasOwnProperty(va)))switch(ja[va]=N.attr(va),null==ja[va]&&(ja[va]=La[va]),oa[va]=Ra[va],Pa[va]){case fa:ma[va]=(oa[va]-ja[va])/ ha;break;case "colour":ja[va]=h.getRGB(ja[va]);ra=h.getRGB(oa[va]);ma[va]={r:(ra.r-ja[va].r)/ha,g:(ra.g-ja[va].g)/ha,b:(ra.b-ja[va].b)/ha};break;case "path":ra=Fa(ja[va],oa[va]);wa=ra[1];ja[va]=ra[0];ma[va]=[];ra=0;for(ua=ja[va].length;ra';var la=ia.firstChild;la.style.behavior="url(#default#VML)";if(!la||"object"!=typeof la.adj)return h.type="";ia=null}h.svg=!(h.vml="VML"==h.type);h._Paper=q;h.fn=m=q.prototype=h.prototype;h._id=0;h.is=function(v,N){N=A.call(N);return"finite"==N?!qa.hasOwnProperty(+v):"array"==N?v instanceof Array:"null"==N&&null===v||N==typeof v&&null!==v||"object"==N&&v===Object(v)||"array"==N&&Array.isArray&& Array.isArray(v)||pa.call(v).slice(8,-1).toLowerCase()==N};h.angle=function(v,N,P,T,X,ba){return null==X?(v-=P,N-=T,v||N?(180*K.atan2(-N,-v)/da+540)%360:0):h.angle(v,N,X,ba)-h.angle(P,T,X,ba)};h.rad=function(v){return v%360*da/180};h.deg=function(v){return Math.round(180*v/da%360*1E3)/1E3};h.snapTo=function(v,N,P){P=h.is(P,"finite")?P:10;if(h.is(v,ka))for(var T=v.length;T--;){if(aa(v[T]-N)<=P)return v[T]}else{v=+v;T=N%v;if(Tv-P)return N-T+v}return N};h.createUUID=function(v,N){return function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(v, N).toUpperCase()}}(/[xy]/g,function(v){var N=16*K.random()|0;return("x"==v?N:N&3|8).toString(16)});h.setWindow=function(v){g("raphael.setWindow",h,O.win,v);O.win=v;O.doc=O.win.document;h._engine.initWin&&h._engine.initWin(O.win)};var Ca=function(v){if(h.vml){var N=/^\s+|\s+$/g;try{var P=new ActiveXObject("htmlfile");P.write("");P.close();var T=P.body}catch(ha){T=createPopup().document.body}var X=T.createTextRange();Ca=n(function(ha){try{T.style.color=D(ha).replace(N,"");var ja=X.queryCommandValue("ForeColor"); return"#"+("000000"+((ja&255)<<16|ja&65280|(ja&16711680)>>>16).toString(16)).slice(-6)}catch(oa){return"none"}})}else{var ba=O.doc.createElement("i");ba.title="Rapha\u00ebl Colour Picker";ba.style.display="none";O.doc.body.appendChild(ba);Ca=n(function(ha){ba.style.color=ha;return O.doc.defaultView.getComputedStyle(ba,"").getPropertyValue("color")})}return Ca(v)},xa=function(){return"hsb("+[this.h,this.s,this.b]+")"},Ga=function(){return"hsl("+[this.h,this.s,this.l]+")"},Ma=function(){return this.hex}, Ua=function(v,N,P){null==N&&h.is(v,"object")&&"r"in v&&"g"in v&&"b"in v&&(P=v.b,N=v.g,v=v.r);null==N&&h.is(v,"string")&&(P=h.getRGB(v),v=P.r,N=P.g,P=P.b);if(1P?P:1-P);N=ha*(1-aa(v%2-1));P=X=ba=P-ha/2;v=~~v;P+=[ha,N,0,0,N,ha][v];X+=[N,ha,ha,N,0,0][v];ba+=[0,0,N,ha,ha,N][v];return ab(P,X,ba,T)};h.rgb2hsb=function(v,N,P){P=Ua(v,N,P);v=P[0];N=P[1];P=P[2];var T=S(v,N,P);var X=T-R(v,N,P);return{h:((0==X?null:T==v?(N-P)/X:T==N?(P-v)/X+2:(v-N)/X+4)+360)%6*60/360, s:0==X?0:X/T,b:T,toString:xa}};h.rgb2hsl=function(v,N,P){P=Ua(v,N,P);v=P[0];N=P[1];P=P[2];var T=S(v,N,P);var X=R(v,N,P);var ba=T-X;X=(T+X)/2;return{h:((0==ba?null:T==v?(N-P)/ba:T==N?(P-v)/ba+2:(v-N)/ba+4)+360)%6*60/360,s:0==ba?0:.5>X?ba/(2*X):ba/(2-2*X),l:X,toString:Ga}};h._path2string=function(){return this.join(",").replace(Va,"$1")};h._preload=function(v,N){var P=O.doc.createElement("img");P.style.cssText="position:absolute;left:-9999em;top:-9999em";P.onload=function(){N.call(this);this.onload= null;O.doc.body.removeChild(this)};P.onerror=function(){O.doc.body.removeChild(this)};O.doc.body.appendChild(P);P.src=v};h.getRGB=n(function(v){if(!v||(v=D(v)).indexOf("-")+1)return{r:-1,g:-1,b:-1,hex:"none",error:1,toString:t};if("none"==v)return{r:-1,g:-1,b:-1,hex:"none",toString:t};!Ha.hasOwnProperty(v.toLowerCase().substring(0,2))&&"#"!=v.charAt()&&(v=Ca(v));var N,P;if(v=v.match(sa)){if(v[2]){var T=Ia(v[2].substring(5),16);var X=Ia(v[2].substring(3,5),16);var ba=Ia(v[2].substring(1,3),16)}v[3]&& (T=Ia((P=v[3].charAt(3))+P,16),X=Ia((P=v[3].charAt(2))+P,16),ba=Ia((P=v[3].charAt(1))+P,16));v[4]&&(P=v[4].split(Oa),ba=Ba(P[0]),"%"==P[0].slice(-1)&&(ba*=2.55),X=Ba(P[1]),"%"==P[1].slice(-1)&&(X*=2.55),T=Ba(P[2]),"%"==P[2].slice(-1)&&(T*=2.55),"rgba"==v[1].toLowerCase().slice(0,4)&&(N=Ba(P[3])),P[3]&&"%"==P[3].slice(-1)&&(N/=100));if(v[5])return P=v[5].split(Oa),ba=Ba(P[0]),"%"==P[0].slice(-1)&&(ba*=2.55),X=Ba(P[1]),"%"==P[1].slice(-1)&&(X*=2.55),T=Ba(P[2]),"%"==P[2].slice(-1)&&(T*=2.55),"deg"!= P[0].slice(-3)&&"\u00b0"!=P[0].slice(-1)||(ba/=360),"hsba"==v[1].toLowerCase().slice(0,4)&&(N=Ba(P[3])),P[3]&&"%"==P[3].slice(-1)&&(N/=100),h.hsb2rgb(ba,X,T,N);if(v[6])return P=v[6].split(Oa),ba=Ba(P[0]),"%"==P[0].slice(-1)&&(ba*=2.55),X=Ba(P[1]),"%"==P[1].slice(-1)&&(X*=2.55),T=Ba(P[2]),"%"==P[2].slice(-1)&&(T*=2.55),"deg"!=P[0].slice(-3)&&"\u00b0"!=P[0].slice(-1)||(ba/=360),"hsla"==v[1].toLowerCase().slice(0,4)&&(N=Ba(P[3])),P[3]&&"%"==P[3].slice(-1)&&(N/=100),h.hsl2rgb(ba,X,T,N);v={r:ba,g:X,b:T, toString:t};v.hex="#"+(16777216|T|X<<8|ba<<16).toString(16).slice(1);h.is(N,"finite")&&(v.opacity=N);return v}return{r:-1,g:-1,b:-1,hex:"none",error:1,toString:t}},h);h.hsb=n(function(v,N,P){return h.hsb2rgb(v,N,P).hex});h.hsl=n(function(v,N,P){return h.hsl2rgb(v,N,P).hex});h.rgb=n(function(v,N,P){return"#"+(P+.5|16777216|(N+.5|0)<<8|(v+.5|0)<<16).toString(16).slice(1)});h.getColor=function(v){v=this.getColor.start=this.getColor.start||{h:0,s:1,b:v||.75};var N=this.hsb2rgb(v.h,v.s,v.b);v.h+=.075; 1=v.s&&(this.getColor.start={h:0,s:1,b:v.b}));return N.hex};h.getColor.reset=function(){delete this.start};h.parsePathString=function(v){if(!v)return null;var N=jb(v);if(N.arr)return fb(N.arr);var P={a:7,c:6,h:1,l:2,m:2,r:4,q:4,s:4,t:2,v:1,z:0},T=[];h.is(v,ka)&&h.is(v[0],ka)&&(T=fb(v));T.length||D(v).replace(Wa,function(X,ba,ha){var ja=[];X=ba.toLowerCase();ha.replace(Xa,function(oa,ma){ma&&ja.push(+ma)});"m"==X&&2=P[X]&&(T.push([ba].concat(ja.splice(0,P[X]))),P[X]););});T.toString=h._path2string;N.arr=fb(T);return T};h.parseTransformString=n(function(v){if(!v)return null;var N=[];h.is(v,ka)&&h.is(v[0],ka)&&(N=fb(v));N.length||D(v).replace(Sa,function(P,T,X){var ba=[];A.call(T);X.replace(Xa,function(ha,ja){ja&&ba.push(+ja)});N.push([T].concat(ba))});N.toString=h._path2string;return N},this,function(v){if(!v)return v;for(var N=[],P=0;PTa||Ea= v.x&&N<=v.x2&&P>=v.y&&P<=v.y2};h.isBBoxIntersect=function(v,N){var P=h.isPointInsideBBox;return P(N,v.x,v.y)||P(N,v.x2,v.y)||P(N,v.x,v.y2)||P(N,v.x2,v.y2)||P(v,N.x,N.y)||P(v,N.x2,N.y)||P(v,N.x,N.y2)||P(v,N.x2,N.y2)||(v.xN.x||N.xv.x)&&(v.yN.y||N.yv.y)};h.pathIntersection=function(v,N){return E(v,N)};h.pathIntersectionNumber=function(v,N){return E(v,N,1)};h.isPointInsidePath=function(v,N,P){var T=h.pathBBox(v);return h.isPointInsideBBox(T,N,P)&&1==E(v,[["M", N,P],["H",T.x2+10]],1)%2};h._removedFactory=function(v){return function(){g("raphael.log",null,"Rapha\u00ebl: you are calling to method \u201c"+v+"\u201d of removed object",v)}};var kb=h.pathBBox=function(v){var N=jb(v);if(N.bbox)return l(N.bbox);if(!v)return{x:0,y:0,width:0,height:0,x2:0,y2:0};v=Fa(v);for(var P=0,T=0,X=[],ba=[],ha,ja=0,oa=v.length;jaRa&&(Ra=2*da+Ra);0>ua&&(ua=2*da+ua);ha&&Ra>ua&&(Ra-=2*da);!ha&&ua>Ra&&(ua-=2*da)}if(aa(ua-Ra)>ra){Aa=ua;Ta=ja;var va=oa;ua=Ra+ra*(ha&&ua>Ra?1:-1);ja=ba+P*K.cos(ua);oa=Qa+T*K.sin(ua);Aa=ta(ja,oa,P,T,X,0,ha,Ta,va,[ua,Aa,ba,Qa])}ba=ua-Ra;X=K.cos(Ra);ra=K.sin(Ra);ha=K.cos(ua);ua=K.sin(ua);ba=K.tan(ba/4);P=4/ 3*P*ba;ba*=4/3*T;T=[v,N];v=[v+P*ra,N-ba*X];N=[ja+P*ua,oa-ba*ha];ja=[ja,oa];v[0]=2*T[0]-v[0];v[1]=2*T[1]-v[1];if(ma)return[v,N,ja].concat(Aa);Aa=[v,N,ja].concat(Aa).join().split(",");ma=[];ja=0;for(oa=Aa.length;jawa&&(wa=Na(v,N,P,T,X,ba,ha,ja,wa),Ea.push(wa.x),Aa.push(wa.y));0oa&&(wa=Na(v,N,P,T,X,ba,ha,ja,oa),Ea.push(wa.x),Aa.push(wa.y));oa=ba-2*T+N-(ja-2*ba+T);ma=2*(T-N)-2*(ba-T);ra=N-T;wa=(-ma+K.sqrt(ma*ma-4*oa*ra))/2/oa;oa=(-ma-K.sqrt(ma*ma-4*oa*ra))/2/oa;"1e12"wa&&(wa=Na(v,N,P,T,X,ba,ha,ja,wa),Ea.push(wa.x),Aa.push(wa.y));0oa&&(wa=Na(v,N,P,T,X,ba,ha,ja,oa),Ea.push(wa.x),Aa.push(wa.y));return{min:{x:R[F](0,Ea),y:R[F](0,Aa)},max:{x:S[F](0,Ea),y:S[F](0,Aa)}}}),Fa=h._path2curve=n(function(v,N){var P=!N&&jb(v);if(!N&&P.curve)return fb(P.curve);var T=nb(v),X=N&&nb(N);v={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null};N={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null};var ba=function(va,Ja,Za){if(!va)return["C",Ja.x,Ja.y,Ja.x,Ja.y,Ja.x,Ja.y];va[0]in{T:1,Q:1}|| (Ja.qx=Ja.qy=null);switch(va[0]){case "M":Ja.X=va[1];Ja.Y=va[2];break;case "A":va=["C"].concat(ta[F](0,[Ja.x,Ja.y].concat(va.slice(1))));break;case "S":"C"==Za||"S"==Za?(Za=2*Ja.x-Ja.bx,Ja=2*Ja.y-Ja.by):(Za=Ja.x,Ja=Ja.y);va=["C",Za,Ja].concat(va.slice(1));break;case "T":"Q"==Za||"T"==Za?(Ja.qx=2*Ja.x-Ja.qx,Ja.qy=2*Ja.y-Ja.qy):(Ja.qx=Ja.x,Ja.qy=Ja.y);va=["C"].concat(Db(Ja.x,Ja.y,Ja.qx,Ja.qy,va[1],va[2]));break;case "Q":Ja.qx=va[1];Ja.qy=va[2];va=["C"].concat(Db(Ja.x,Ja.y,va[1],va[2],va[3],va[4])); break;case "L":va=["C"].concat(ub(Ja.x,Ja.y,va[1],va[2]));break;case "H":va=["C"].concat(ub(Ja.x,Ja.y,va[1],Ja.y));break;case "V":va=["C"].concat(ub(Ja.x,Ja.y,Ja.x,va[1]));break;case "Z":va=["C"].concat(ub(Ja.x,Ja.y,Ja.X,Ja.Y))}return va},ha=function(va,Ja){if(7T;T++)for(ba=0;3>ba;ba++){for(ha=ja=0;3>ha;ha++)ja+=ra[T][ha]*X[ha][ba];ma[T][ba]=ja}this.a=ma[0][0];this.b=ma[1][0];this.c=ma[0][1];this.d=ma[1][1];this.e=ma[0][2];this.f=ma[1][2]};v.invert=function(){var T=this.a*this.d-this.b*this.c;return new H(this.d/T,-this.b/T,-this.c/T,this.a/T,(this.c*this.f-this.d*this.e)/T,(this.b*this.e-this.a*this.f)/T)};v.clone=function(){return new H(this.a,this.b,this.c,this.d,this.e,this.f)};v.translate= function(T,X){this.add(1,0,0,1,T,X)};v.scale=function(T,X,ba,ha){null==X&&(X=T);(ba||ha)&&this.add(1,0,0,1,ba,ha);this.add(T,0,0,X,0,0);(ba||ha)&&this.add(1,0,0,1,-ba,-ha)};v.rotate=function(T,X,ba){T=h.rad(T);X=X||0;ba=ba||0;var ha=+K.cos(T).toFixed(9);T=+K.sin(T).toFixed(9);this.add(ha,T,-T,ha,X,ba);this.add(1,0,0,1,-X,-ba)};v.x=function(T,X){return T*this.a+X*this.c+this.e};v.y=function(T,X){return T*this.b+X*this.d+this.f};v.get=function(T){return+this[D.fromCharCode(97+T)].toFixed(4)};v.toString= function(){return h.svg?"matrix("+[this.get(0),this.get(1),this.get(2),this.get(3),this.get(4),this.get(5)].join()+")":[this.get(0),this.get(2),this.get(1),this.get(3),0,0].join()};v.toFilter=function(){return"progid:DXImageTransform.Microsoft.Matrix(M11="+this.get(0)+", M12="+this.get(2)+", M21="+this.get(1)+", M22="+this.get(3)+", Dx="+this.get(4)+", Dy="+this.get(5)+", sizingmethod='auto expand')"};v.offset=function(){return[this.e.toFixed(4),this.f.toFixed(4)]};v.split=function(){var T={};T.dx= this.e;T.dy=this.f;var X=[[this.a,this.c],[this.b,this.d]];T.scalex=K.sqrt(N(X[0]));P(X[0]);T.shear=X[0][0]*X[1][0]+X[0][1]*X[1][1];X[1]=[X[1][0]-X[0][0]*T.shear,X[1][1]-X[0][1]*T.shear];T.scaley=K.sqrt(N(X[1]));P(X[1]);T.shear/=T.scaley;var ba=-X[0][1];X=X[1][1];0>X?(T.rotate=h.deg(K.acos(X)),0>ba&&(T.rotate=360-T.rotate)):T.rotate=h.deg(K.asin(ba));T.isSimple=!+T.shear.toFixed(9)&&(T.scalex.toFixed(9)==T.scaley.toFixed(9)||!T.rotate);T.isSuperSimple=!+T.shear.toFixed(9)&&T.scalex.toFixed(9)==T.scaley.toFixed(9)&& !T.rotate;T.noRotation=!+T.shear.toFixed(9)&&!T.rotate;return T};v.toTransformString=function(T){T=T||this.split();return T.isSimple?(T.scalex=+T.scalex.toFixed(4),T.scaley=+T.scaley.toFixed(4),T.rotate=+T.rotate.toFixed(4),(T.dx||T.dy?"t"+[T.dx,T.dy]:"")+(1!=T.scalex||1!=T.scaley?"s"+[T.scalex,T.scaley,0,0]:"")+(T.rotate?"r"+[T.rotate,0,0]:"")):"m"+[this.get(0),this.get(1),this.get(2),this.get(3),this.get(4),this.get(5)]}})(H.prototype);for(var fc=function(){this.returnValue=!1},gc=function(){return this.originalEvent.preventDefault()}, hc=function(){this.cancelBubble=!0},ic=function(){return this.originalEvent.stopPropagation()},ac=function(v){return{x:v.clientX+(O.doc.documentElement.scrollLeft||O.doc.body.scrollLeft),y:v.clientY+(O.doc.documentElement.scrollTop||O.doc.body.scrollTop)}},jc=function(){if(O.doc.addEventListener)return function(v,N,P,T){var X=function(ha){var ja=ac(ha);return P.call(T,ha,ja.x,ja.y)};v.addEventListener(N,X,!1);if(z&&u[N]){var ba=function(ha){for(var ja=ac(ha),oa=ha,ma=0,ra=ha.targetTouches&&ha.targetTouches.length;ma< ra;ma++)if(ha.targetTouches[ma].target==v){ha=ha.targetTouches[ma];ha.originalEvent=oa;ha.preventDefault=gc;ha.stopPropagation=ic;break}return P.call(T,ha,ja.x,ja.y)};v.addEventListener(u[N],ba,{passive:!0})}return function(){v.removeEventListener(N,X,!1);z&&u[N]&&v.removeEventListener(u[N],ba,!1);return!0}};if(O.doc.attachEvent)return function(v,N,P,T){var X=function(ba){ba=ba||O.win.event;var ha=ba.clientX+(O.doc.documentElement.scrollLeft||O.doc.body.scrollLeft),ja=ba.clientY+(O.doc.documentElement.scrollTop|| O.doc.body.scrollTop);ba.preventDefault=ba.preventDefault||fc;ba.stopPropagation=ba.stopPropagation||hc;return P.call(T,ba,ha,ja)};v.attachEvent("on"+N,X);return function(){v.detachEvent("on"+N,X);return!0}}}(),Cb=[],Qb=function(v){for(var N=v.clientX,P=v.clientY,T=O.doc.documentElement.scrollTop||O.doc.body.scrollTop,X=O.doc.documentElement.scrollLeft||O.doc.body.scrollLeft,ba,ha=Cb.length;ha--;){ba=Cb[ha];if(z&&v.touches)for(var ja=v.touches.length,oa;ja--;){if(oa=v.touches[ja],oa.identifier==ba.el._drag.id){N= oa.clientX;P=oa.clientY;(v.originalEvent?v.originalEvent:v).preventDefault();break}}else v.preventDefault();ja=ba.el.node;var ma=ja.nextSibling,ra=ja.parentNode,wa=ja.style.display;O.win.opera&&ra.removeChild(ja);ja.style.display="none";oa=ba.el.paper.getElementByPoint(N,P);ja.style.display=wa;O.win.opera&&(ma?ra.insertBefore(ja,ma):ra.appendChild(ja));oa&&g("raphael.drag.over."+ba.el.id,ba.el,oa);N+=X;P+=T;g("raphael.drag.move."+ba.el.id,ba.move_scope||ba.el,N-ba.el._drag.x,P-ba.el._drag.y,N,P,v)}}, Rb=function(v){h.unmousemove(Qb).unmouseup(Rb);for(var N=Cb.length,P;N--;)P=Cb[N],P.el._drag={},g("raphael.drag.end."+P.el.id,P.end_scope||P.start_scope||P.move_scope||P.el,v);Cb=[]},cb=h.el={},bc=w.length;bc--;)(function(v){h[v]=cb[v]=function(N,P){h.is(N,"function")&&(this.events=this.events||[],this.events.push({name:v,f:N,unbind:jc(this.shape||this.node||O.doc,v,N,P||this)}));return this};h["un"+v]=cb["un"+v]=function(N){for(var P=this.events||[],T=P.length;T--;)P[T].name!=v||!h.is(N,"undefined")&& P[T].f!=N||(P[T].unbind(),P.splice(T,1),!P.length&&delete this.events);return this}})(w[bc]);cb.data=function(v,N){var P=db[this.id]=db[this.id]||{};if(0==arguments.length)return P;if(1==arguments.length){if(h.is(v,"object")){for(var T in v)v.hasOwnProperty(T)&&this.data(T,v[T]);return this}g("raphael.data.get."+this.id,this,P[v],v);return P[v]}P[v]=N;g("raphael.data.set."+this.id,this,N,v);return this};cb.removeData=function(v){null==v?delete db[this.id]:db[this.id]&&delete db[this.id][v];return this}; cb.getData=function(){return l(db[this.id]||{})};cb.hover=function(v,N,P,T){return this.mouseover(v,P).mouseout(N,T||P)};cb.unhover=function(v,N){return this.unmouseover(v).unmouseout(N)};var Fb=[];cb.drag=function(v,N,P,T,X,ba){function ha(ja){(ja.originalEvent||ja).preventDefault();var oa=ja.clientX,ma=ja.clientY,ra=O.doc.documentElement.scrollTop||O.doc.body.scrollTop,wa=O.doc.documentElement.scrollLeft||O.doc.body.scrollLeft;this._drag.id=ja.identifier;if(z&&ja.touches)for(var Aa=ja.touches.length, Ea;Aa--;)if(Ea=ja.touches[Aa],this._drag.id=Ea.identifier,Ea.identifier==this._drag.id){oa=Ea.clientX;ma=Ea.clientY;break}this._drag.x=oa+wa;this._drag.y=ma+ra;!Cb.length&&h.mousemove(Qb).mouseup(Rb);Cb.push({el:this,move_scope:T,start_scope:X,end_scope:ba});N&&g.on("raphael.drag.start."+this.id,N);v&&g.on("raphael.drag.move."+this.id,v);P&&g.on("raphael.drag.end."+this.id,P);g("raphael.drag.start."+this.id,X||T||this,this._drag.x,this._drag.y,ja)}this._drag={};Fb.push({el:this,start:ha});this.mousedown(ha); return this};cb.onDragOver=function(v){v?g.on("raphael.drag.over."+this.id,v):g.unbind("raphael.drag.over."+this.id)};cb.undrag=function(){for(var v=Fb.length;v--;)Fb[v].el==this&&(this.unmousedown(Fb[v].start),Fb.splice(v,1),g.unbind("raphael.drag.*."+this.id));!Fb.length&&h.unmousemove(Qb).unmouseup(Rb);Cb=[]};m.circle=function(v,N,P){v=h._engine.circle(this,v||0,N||0,P||0);this.__set__&&this.__set__.push(v);return v};m.rect=function(v,N,P,T,X){v=h._engine.rect(this,v||0,N||0,P||0,T||0,X||0);this.__set__&& this.__set__.push(v);return v};m.ellipse=function(v,N,P,T){v=h._engine.ellipse(this,v||0,N||0,P||0,T||0);this.__set__&&this.__set__.push(v);return v};m.path=function(v){v&&!h.is(v,"string")&&!h.is(v[0],ka)&&(v+="");var N=h._engine.path(h.format[F](h,arguments),this);this.__set__&&this.__set__.push(N);return N};m.image=function(v,N,P,T,X){v=h._engine.image(this,v||"about:blank",N||0,P||0,T||0,X||0);this.__set__&&this.__set__.push(v);return v};m.text=function(v,N,P){v=h._engine.text(this,v||0,N||0, D(P));this.__set__&&this.__set__.push(v);return v};m.set=function(v){!h.is(v,"array")&&(v=Array.prototype.splice.call(arguments,0,arguments.length));var N=new Hb(v);this.__set__&&this.__set__.push(N);N.paper=this;N.type="set";return N};m.setStart=function(v){this.__set__=v||this.set()};m.setFinish=function(v){v=this.__set__;delete this.__set__;return v};m.getSize=function(){var v=this.canvas.parentNode;return{width:v.offsetWidth,height:v.offsetHeight}};m.setSize=function(v,N){return h._engine.setSize.call(this, v,N)};m.setViewBox=function(v,N,P,T,X){return h._engine.setViewBox.call(this,v,N,P,T,X)};m.top=m.bottom=null;m.raphael=h;m.getElementByPoint=function(v,N){var P=this.canvas,T=O.doc.elementFromPoint(v,N);if(O.win.opera&&"svg"==T.tagName){var X=P.getBoundingClientRect();var ba=P.ownerDocument;var ha=ba.body,ja=ba.documentElement;ba=X.top+(O.win.pageYOffset||ja.scrollTop||ha.scrollTop)-(ja.clientTop||ha.clientTop||0);X=X.left+(O.win.pageXOffset||ja.scrollLeft||ha.scrollLeft)-(ja.clientLeft||ha.clientLeft|| 0);ha=P.createSVGRect();ha.x=v-X;ha.y=N-ba;ha.width=ha.height=1;v=P.getIntersectionList(ha,null);v.length&&(T=v[v.length-1])}if(!T)return null;for(;T.parentNode&&T!=P.parentNode&&!T.raphael;)T=T.parentNode;T==this.canvas.parentNode&&(T=P);return T=T&&T.raphael?this.getById(T.raphaelid):null};m.getElementsByBBox=function(v){var N=this.set();this.forEach(function(P){h.isBBoxIntersect(P.getBBox(),v)&&N.push(P)});return N};m.getById=function(v){for(var N=this.bottom;N;){if(N.id==v)return N;N=N.next}return null}; m.forEach=function(v,N){for(var P=this.bottom;P&&!1!==v.call(N,P);)P=P.next;return this};m.getElementsByPoint=function(v,N){var P=this.set();this.forEach(function(T){T.isPointInside(v,N)&&P.push(T)});return P};cb.isPointInside=function(v,N){var P=this.realPath=ya[this.type](this);this.attr("transform")&&this.attr("transform").length&&(P=h.transformPath(P,this.attr("transform")));return h.isPointInsidePath(P,v,N)};cb.getBBox=function(v){if(this.removed)return{};var N=this._;if(v){if(N.dirty||!N.bboxwt)this.realPath= ya[this.type](this),N.bboxwt=kb(this.realPath),N.bboxwt.toString=B,N.dirty=0;return N.bboxwt}if(N.dirty||N.dirtyT||!N.bbox){if(N.dirty||!this.realPath)N.bboxwt=0,this.realPath=ya[this.type](this);N.bbox=kb(W(this.realPath,this.matrix));N.bbox.toString=B;N.dirty=N.dirtyT=0}return N.bbox};cb.clone=function(){if(this.removed)return null;var v=this.paper[this.type]().attr(this.attr());this.__set__&&this.__set__.push(v);return v};cb.glow=function(v){if("text"==this.type)return null;v=v||{};var N=(v.width|| 10)+(+this.attr("stroke-width")||1),P=v.fill||!1,T=null==v.opacity?.5:v.opacity,X=v.offsetx||0,ba=v.offsety||0;v=v.color||"#000";var ha=N/2,ja=this.paper,oa=ja.set(),ma=this.realPath||ya[this.type](this);ma=this.matrix?W(ma,this.matrix):ma;for(var ra=1;raoa||p(v,N,P,T,X,ba,ha,ja)T){if(N&&!ra.start){ba=Sb(ba,ha,ja[1],ja[2],ja[3],ja[4],ja[5],ja[6],T-wa);ma+=["C"+ba.start.x,ba.start.y,ba.m.x,ba.m.y,ba.x,ba.y];if(X)return ma;ra.start=ma;ma=["M"+ba.x,ba.y+"C"+ba.n.x,ba.n.y,ba.end.x,ba.end.y,ja[5],ja[6]].join();wa+=oa;ba=+ja[5];ha=+ja[6];continue}if(!v&&!N)return ba=Sb(ba,ha,ja[1],ja[2],ja[3],ja[4],ja[5],ja[6],T-wa),{x:ba.x,y:ba.y,alpha:ba.alpha}}wa+=oa;ba=+ja[5];ha=+ja[6]}ma+=ja.shift()+ja}ra.end=ma;ba=v?wa:N?ra:h.findDotsAtSegment(ba,ha,ja[0],ja[1],ja[2], ja[3],ja[4],ja[5],1);ba.alpha&&(ba={x:ba.x,y:ba.y,alpha:ba.alpha});return ba}},cc=Tb(1),dc=Tb(),Ub=Tb(0,1);h.getTotalLength=cc;h.getPointAtLength=dc;h.getSubpath=function(v,N,P){if(1E-6>this.getTotalLength(v)-P)return Ub(v,N).end;v=Ub(v,P,1);return N?Ub(v,N).end:v};cb.getTotalLength=function(){var v=this.getPath();if(v)return this.node.getTotalLength?this.node.getTotalLength():cc(v)};cb.getPointAtLength=function(v){var N=this.getPath();if(N)return dc(N,v)};cb.getPath=function(){var v,N=h._getPath[this.type]; if("text"!=this.type&&"set"!=this.type)return N&&(v=N(this)),v};cb.getSubpath=function(v,N){var P=this.getPath();if(P)return h.getSubpath(P,v,N)};var qb=h.easing_formulas={linear:function(v){return v},"<":function(v){return ea(v,1.7)},">":function(v){return ea(v,.48)},"<>":function(v){var N=.48-v/1.04,P=K.sqrt(.1734+N*N);v=P-N;v=ea(aa(v),1/3)*(0>v?-1:1);N=-P-N;N=ea(aa(N),1/3)*(0>N?-1:1);v=v+N+.5;return 3*(1-v)*v*v+v*v*v},backIn:function(v){return v*v*(2.70158*v-1.70158)},backOut:function(v){--v;return v* v*(2.70158*v+1.70158)+1},elastic:function(v){return v==!!v?v:ea(2,-10*v)*K.sin(2*(v-.075)*da/.3)+1},bounce:function(v){v<1/2.75?v*=7.5625*v:v<2/2.75?(v-=1.5/2.75,v=7.5625*v*v+.75):v<2.5/2.75?(v-=2.25/2.75,v=7.5625*v*v+.9375):(v-=2.625/2.75,v=7.5625*v*v+.984375);return v}};qb.easeIn=qb["ease-in"]=qb["<"];qb.easeOut=qb["ease-out"]=qb[">"];qb.easeInOut=qb["ease-in-out"]=qb["<>"];qb["back-in"]=qb.backIn;qb["back-out"]=qb.backOut;var $a=[],Zb=window.requestAnimationFrame||window.webkitRequestAnimationFrame|| window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(v){setTimeout(v,16)},Pb=function(){for(var v=+new Date,N=0;N<$a.length;N++){var P=$a[N];if(!P.el.removed&&!P.paused){var T=v-P.start,X=P.ms,ba=P.easing,ha=P.from,ja=P.diff,oa=P.to,ma=P.el,ra={},wa={},Aa;P.initstatus?(T=(P.initstatus*P.anim.top-P.prev)/(P.percent-P.prev)*X,P.status=P.initstatus,delete P.initstatus,P.stop&&$a.splice(N--,1)):P.status=(P.prev+T/X*(P.percent-P.prev))/P.anim.top;if(!(0> T))if(Tv?0:v};cb.animateWith=function(v,N,P,T,X,ba){if(this.removed)return ba&&ba.call(this),this;P=P instanceof J?P:h.animation(P,T,X,ba);C(P,this,P.percents[0],null,this.attr());P=0;for(T=$a.length;PP&&(P=X);P+="%";!v[P].callback&&(v[P].callback= T)}return new J(v,N)};cb.animate=function(v,N,P,T){if(this.removed)return T&&T.call(this),this;v=v instanceof J?v:h.animation(v,N,P,T);C(v,this,v.percents[0],null,this.attr());return this};cb.setTime=function(v,N){v&&null!=N&&this.status(v,R(N,v.ms)/v.ms);return this};cb.status=function(v,N){var P=[],T=0;if(null!=N)return C(v,this,-1,R(N,1)),this;for(N=$a.length;Tv?S(this.length+v,0):v;N=S(0,R(this.length-v,N));var T=[],X=[],ba=[],ha;for(ha=2;haka[2]&&(ka[0]=-ka[2],ka[2]=0);0>ka[3]&&(ka[1]=-ka[3],ka[3]=0)}u=g._parseDots(u);if(!u)return null;K=K.replace(/[\(\)\s,\xb0#]/g,"_");w.gradient&&K!=w.gradient.id&&(ea.defs.removeChild(w.gradient),delete w.gradient);if(!w.gradient)for(fa=C(A+"Gradient",{id:K}),w.gradient=fa,C(fa,"radial"==A?{fx:S,fy:R}:{x1:ka[0],y1:ka[1],x2:ka[2],y2:ka[3],gradientTransform:w.matrix.invert()}),ea.defs.appendChild(fa),w=0,ea=u.length;wA*K?-1:1);aa&&(R=V(aa,S,R),S=R.dx,R=R.dy);0>A&&(sa+="x");0>K&&(sa+=" y")&&(pa=-1);ka.flip=sa;u.coordorigin=S*-qa+" "+R*-za;if(fa||ea.fillsize)S=(S=u.getElementsByTagName("fill"))&&S[0],u.removeChild(S),fa&&(R=V(aa,da.x(fa[0],fa[1]),da.y(fa[0],fa[1])),S.position=R.dx*pa+" "+R.dy*pa),ea.fillsize&&(S.size=ea.fillsize[0]*E(A)+" "+ea.fillsize[1]*E(K)),u.appendChild(S);ka.visibility="visible"}};g.toString=function(){return"Your browser doesn\u2019t support SVG. Falling down to VML.\nYou are running Rapha\u00ebl "+ this.version};var Y=function(u,A,K){A=h(A).toLowerCase().split("-");K=K?"end":"start";for(var S=A.length,R="classic",aa="medium",ea="medium";S--;)switch(A[S]){case "block":case "classic":case "oval":case "diamond":case "open":case "none":R=A[S];break;case "wide":case "narrow":ea=A[S];break;case "long":case "short":aa=A[S]}u=u.node.getElementsByTagName("stroke")[0];u[K+"arrow"]=R;u[K+"arrowlength"]=aa;u[K+"arrowwidth"]=ea},M=function(u,A){u.attrs=u.attrs||{};var K=u.node,S=u.attrs,R=K.style,aa=I[u.type]&& (A.x!=S.x||A.y!=S.y||A.width!=S.width||A.height!=S.height||A.cx!=S.cx||A.cy!=S.cy||A.rx!=S.rx||A.ry!=S.ry||A.r!=S.r),ea=Q[u.type]&&(S.cx!=A.cx||S.cy!=A.cy||S.r!=A.r||S.rx!=A.rx||S.ry!=A.ry);for(da in A)A.hasOwnProperty(da)&&(S[da]=A[da]);aa&&(S.path=g._getPath[u.type](u),u._.dirty=1);A.href&&(K.href=A.href);A.title&&(K.title=A.title);A.target&&(K.target=A.target);A.cursor&&(R.cursor=A.cursor);"blur"in A&&u.blur(A.blur);if(A.path&&"path"==u.type||aa)K.path=U(~h(S.path).toLowerCase().indexOf("r")?g._pathToAbsolute(S.path): S.path),u._.dirty=1,"image"==u.type&&(u._.fillpos=[S.x,S.y],u._.fillsize=[S.width,S.height],O(u,1,1,0,0,0));"transform"in A&&u.transform(A.transform);if(ea){R=+S.cx;aa=+S.cy;ea=+S.rx||+S.r||0;var da=+S.ry||+S.r||0;K.path=g.format("ar{0},{1},{2},{3},{4},{1},{4},{1}x",t(21600*(R-ea)),t(21600*(aa-da)),t(21600*(R+ea)),t(21600*(aa+da)),t(21600*R));u._.dirty=1}"clip-rect"in A&&(R=h(A["clip-rect"]).split(H),4==R.length&&(R[2]=+R[2]+ +R[0],R[3]=+R[3]+ +R[1],aa=K.clipRect||g._g.doc.createElement("div"),ea= aa.style,ea.clip=g.format("rect({1}px {2}px {3}px {0}px)",R),K.clipRect||(ea.position="absolute",ea.top=0,ea.left=0,ea.width=u.paper.width+"px",ea.height=u.paper.height+"px",K.parentNode.insertBefore(aa,K),aa.appendChild(K),K.clipRect=aa)),A["clip-rect"]||K.clipRect&&(K.clipRect.style.clip="auto"));u.textpath&&(R=u.textpath.style,A.font&&(R.font=A.font),A["font-family"]&&(R.fontFamily='"'+A["font-family"].split(",")[0].replace(/^['"]+|['"]+$/g,"")+'"'),A["font-size"]&&(R.fontSize=A["font-size"]), A["font-weight"]&&(R.fontWeight=A["font-weight"]),A["font-style"]&&(R.fontStyle=A["font-style"]));"arrow-start"in A&&Y(u,A["arrow-start"]);"arrow-end"in A&&Y(u,A["arrow-end"],1);if(null!=A.opacity||null!=A.fill||null!=A.src||null!=A.stroke||null!=A["stroke-width"]||null!=A["stroke-opacity"]||null!=A["fill-opacity"]||null!=A["stroke-dasharray"]||null!=A["stroke-miterlimit"]||null!=A["stroke-linejoin"]||null!=A["stroke-linecap"]){R=(R=K.getElementsByTagName("fill"))&&R[0];!R&&(R=z("fill"));"image"== u.type&&A.src&&(R.src=A.src);A.fill&&(R.on=!0);if(null==R.on||"none"==A.fill||null===A.fill)R.on=!1;R.on&&A.fill&&((aa=h(A.fill).match(g._ISURL))?(R.parentNode==K&&K.removeChild(R),R.rotate=!0,R.src=aa[1],R.type="tile",ea=u.getBBox(1),R.position=ea.x+" "+ea.y,u._.fillpos=[ea.x,ea.y],g._preload(aa[1],function(){u._.fillsize=[this.offsetWidth,this.offsetHeight]})):(R.color=g.getRGB(A.fill).hex,R.src="",R.type="solid",g.getRGB(A.fill).error&&(u.type in{circle:1,ellipse:1}||"r"!=h(A.fill).charAt())&& q(u,A.fill,R)&&(S.fill="none",S.gradient=A.fill,R.rotate=!1)));if("fill-opacity"in A||"opacity"in A)ea=((+S["fill-opacity"]+1||2)-1)*((+S.opacity+1||2)-1)*((+g.getRGB(A.fill).o+1||2)-1),ea=p(k(ea,0),1),R.opacity=ea,R.src&&(R.color="none");K.appendChild(R);R=K.getElementsByTagName("stroke")&&K.getElementsByTagName("stroke")[0];aa=!1;!R&&(aa=R=z("stroke"));if(A.stroke&&"none"!=A.stroke||A["stroke-width"]||null!=A["stroke-opacity"]||A["stroke-dasharray"]||A["stroke-miterlimit"]||A["stroke-linejoin"]|| A["stroke-linecap"])R.on=!0;"none"!=A.stroke&&null!==A.stroke&&null!=R.on&&0!=A.stroke&&0!=A["stroke-width"]||(R.on=!1);ea=g.getRGB(A.stroke);R.on&&A.stroke&&(R.color=ea.hex);ea=((+S["stroke-opacity"]+1||2)-1)*((+S.opacity+1||2)-1)*((+ea.o+1||2)-1);da=.75*(l(A["stroke-width"])||1);ea=p(k(ea,0),1);null==A["stroke-width"]&&(da=S["stroke-width"]);A["stroke-width"]&&(R.weight=da);da&&1>da&&(ea*=da)&&(R.weight=1);R.opacity=ea;A["stroke-linejoin"]&&(R.joinstyle=A["stroke-linejoin"]||"miter");R.miterlimit= A["stroke-miterlimit"]||8;A["stroke-linecap"]&&(R.endcap="butt"==A["stroke-linecap"]?"flat":"square"==A["stroke-linecap"]?"square":"round");"stroke-dasharray"in A&&(ea={"-":"shortdash",".":"shortdot","-.":"shortdashdot","-..":"shortdashdotdot",". ":"dot","- ":"dash","--":"longdash","- .":"dashdot","--.":"longdashdot","--..":"longdashdotdot"},R.dashstyle=ea.hasOwnProperty(A["stroke-dasharray"])?ea[A["stroke-dasharray"]]:"");aa&&K.appendChild(R)}if("text"==u.type){u.paper.canvas.style.display="";K= u.paper.span;aa=S.font&&S.font.match(/\d+(?:\.\d*)?(?=px)/);R=K.style;S.font&&(R.font=S.font);S["font-family"]&&(R.fontFamily=S["font-family"]);S["font-weight"]&&(R.fontWeight=S["font-weight"]);S["font-style"]&&(R.fontStyle=S["font-style"]);aa=l(S["font-size"]||aa&&aa[0])||10;R.fontSize=100*aa+"px";u.textpath.string&&(K.innerHTML=h(u.textpath.string).replace(/"));K=K.getBoundingClientRect();u.W=S.w=(K.right-K.left)/100;u.H=S.h=(K.bottom-K.top)/ 100;u.X=S.x;u.Y=S.y+u.H/2;("x"in A||"y"in A)&&(u.path.v=g.format("m{0},{1}l{2},{1}",t(21600*S.x),t(21600*S.y),t(21600*S.x)+1));K="x y text font font-family font-weight font-style font-size".split(" ");R=0;for(aa=K.length;RA.styleSheets.length?A.createStyleSheet().addRule(".rvml","behavior:url(#default#VML)"):A.styleSheets[0].addRule(".rvml","behavior:url(#default#VML)");try{!A.namespaces.rvml&&A.namespaces.add("rvml","urn:schemas-microsoft-com:vml"),z=function(K){return A.createElement("')}}catch(K){z=function(S){return A.createElement("<"+ S+' xmlns="urn:schemas-microsoft.com:vml" class="rvml">')}}};g._engine.initWin(g._g.win);g._engine.create=function(){var u=g._getContainer.apply(0,arguments),A=u.container,K=u.height,S=u.width,R=u.x;u=u.y;if(!A)throw Error("VML container not found.");var aa=new g._Paper,ea=aa.canvas=g._g.doc.createElement("div"),da=ea.style;R=R||0;u=u||0;S=S||512;K=K||342;aa.width=S;aa.height=K;S==+S&&(S+="px");K==+K&&(K+="px");aa.coordsize="21600000 21600000";aa.coordorigin="0 0";aa.span=g._g.doc.createElement("span"); aa.span.style.cssText="position:absolute;left:-9999em;top:-9999em;padding:0;margin:0;line-height:1;";ea.appendChild(aa.span);da.cssText=g.format("top:0;left:0;width:{0};height:{1};display:inline-block;position:relative;clip:rect(0 {0} {1} 0);overflow:hidden",S,K);1==A?(g._g.doc.body.appendChild(ea),da.left=R+"px",da.top=u+"px",da.position="absolute"):A.firstChild?A.insertBefore(ea,A.firstChild):A.appendChild(ea);aa.renderfix=function(){};return aa};g.prototype.clear=function(){g.eve("raphael.clear", this);this.canvas.innerHTML="";this.span=g._g.doc.createElement("span");this.span.style.cssText="position:absolute;left:-9999em;top:-9999em;padding:0;margin:0;line-height:1;display:inline;";this.canvas.appendChild(this.span);this.bottom=this.top=null};g.prototype.remove=function(){g.eve("raphael.remove",this);this.canvas.parentNode.removeChild(this.canvas);for(var u in this)this[u]="function"==typeof this[u]?g._removedFactory(u):null;return!0};var D=g.st,w;for(w in F)F.hasOwnProperty(w)&&!D.hasOwnProperty(w)&& (D[w]=function(u){return function(){var A=arguments;return this.forEach(function(K){K[u].apply(K,A)})}}(w))}}.apply(a,f),void 0!==e&&(d.exports=e))},"./node_modules/eve-raphael/eve.js":function(d,a,b){var f,e;(function(g){var h=/[\.\/]/,l=/\s*,\s*/,n=function(L,I){return L-I},t,k,p={n:{}},E=function(){for(var L=0,I=this.length;LV[F].zIndex&&(M[V[F].zIndex]=V[F]));for(Y.sort(n);0>Y[O];){var D=M[Y[O++]];q.push(D.apply(I,U));if(k)return k=Q,q}for(F=0;Ff?2*f*f:-1+(4-2*f)*f},cubicIn:function(f){return f*f*f},cubicOut:function(f){return--f* f*f+1},cubicInOut:function(f){return.5>f?4*f*f*f:(f-1)*(2*f-2)*(2*f-2)+1},quartIn:function(f){return f*f*f*f},quartOut:function(f){return 1- --f*f*f*f},quartInOut:function(f){return.5>f?8*f*f*f*f:1-8*--f*f*f*f},quintIn:function(f){return f*f*f*f*f},quintOut:function(f){return 1+--f*f*f*f*f},quintInOut:function(f){return.5>f?16*f*f*f*f*f:1+16*--f*f*f*f*f}};d.createAnimation=function(f){var e=f.easing?f.easing:d.easing.linear,g="number"==typeof f.duration?f.duration:350,h="function"==typeof f.onAnimation? f.onAnimation:null,l="function"==typeof f.onEnd?f.onEnd:null,n="function"==typeof f.onStart?f.onStart:null,t=f.type?f.type:"setTimeout",k="boolean"==typeof f.repeat?f.repeat:!1,p=f.rate?f.rate:20,E=f.delay?f.delay:0,H,B=null,G,J=!1,C=function(L){if(!J){null===B&&(n&&n.call(this),B="setTimeout"==t?new Date:L);G="setTimeout"==t?new Date:L;var I="setTimeout"==t?Math.abs(G.getTime()-B.getTime()):Math.abs(L-B);percent=e(I/g);h&&h.call(this,percent);1>percent&&In;n++)if(!a||2!=n||void 0!==b.z)switch(0==n?(h=f,l="x"):1==n?(h=e,l="y"):(h=g,l="z"),d.axis[n]){case "e":b[l]=h;break;case "w":b[l]=-h;break;case "n":b[l]=h;break;case "s":b[l]=-h;break;case "u":void 0!==b[l]&&(b.z=h);break;case "d":void 0!==b[l]&&(b.z=-h);break;default:return alert("ERROR: unknow axis ("+ d.axis[n]+") - check definition of "+d.projName),null}return b},reportError:function(){},extend:function(d,a){d=d||{};if(a)for(var b in a){var f=a[b];void 0!==f&&(d[b]=f)}return d},Class:function(){for(var d=function(){this.initialize.apply(this,arguments)},a={},b,f=0;f=g;g++)if(f=d*Math.sin(e),f=this.HALF_PI-2*Math.atan(a*Math.pow((1-f)/(1+f),b))-e,e+=f,1E-10>=Math.abs(f))return e;alert("phi2z has NoConvergence");return-9999},qsfnz:function(d,a){var b;return 1E-7d?-1:1},adjust_lon:function(d){return Math.abs(d)this.HALF_PI)return+Number.NaN;if(a==this.HALF_PI)return Number.POSITIVE_INFINITY;if(a==-1*this.HALF_PI)return-1*Number.POSITIVE_INFINITY;b*=d;return Math.log(Math.tan((this.HALF_PI+a)/2))+d*Math.log((1-b)/(1+b))/2},fL:function(d,a){return 2*Math.atan(d*Math.exp(a))-this.HALF_PI},invlatiso:function(d,a){var b=this.fL(1,a);do{var f=b;b=d*Math.sin(f);b=this.fL(Math.exp(d*Math.log((1+b)/(1-b))/2),a)}while(1E-12-1.001*Proj4js.common.HALF_PI)b=-Proj4js.common.HALF_PI;else if(b>Proj4js.common.HALF_PI&&b<1.001*Proj4js.common.HALF_PI)b=Proj4js.common.HALF_PI;else if(b<-Proj4js.common.HALF_PI||b>Proj4js.common.HALF_PI)return Proj4js.reportError("geocent:lat out of range:"+b),null;a>Proj4js.common.PI&&(a-=2*Proj4js.common.PI);var e=Math.sin(b);var g=Math.cos(b);var h=this.a/Math.sqrt(1-this.es*e*e);b=(h+f)*g* Math.cos(a);a=(h+f)*g*Math.sin(a);f=(h*(1-this.es)+f)*e;d.x=b;d.y=a;d.z=f;return 0},geocentric_to_geodetic:function(d){var a=d.x;var b=d.y;var f=d.z?d.z:0;var e=Math.sqrt(a*a+b*b);var g=Math.sqrt(a*a+b*b+f*f);if(1E-12>e/this.a){if(a=0,1E-12>g/this.a)return}else a=Math.atan2(b,a);b=f/g;var h=e/g;var l=1/Math.sqrt(1-this.es*(2-this.es)*h*h);var n=h*(1-this.es)*l;var t=b*l;var k=0;do{k++;var p=this.a/Math.sqrt(1-this.es*t*t);g=e*n+f*t-p*(1-this.es*t*t);p=this.es*p/(p+g);l=1/Math.sqrt(1-p*(2-p)*h*h); p=h*(1-p)*l;l*=b;var E=l*n-p*t;n=p;t=l}while(1E-24k);e=Math.atan(l/Math.abs(p));d.x=a;d.y=e;d.z=g;return d},geocentric_to_geodetic_noniter:function(d){var a=d.x,b=d.y,f=d.z?d.z:0;a=parseFloat(a);b=parseFloat(b);f=parseFloat(f);var e=!1;if(0!=a)var g=Math.atan2(b,a);else if(0b)g=-Proj4js.common.HALF_PI;else if(e=!0,g=0,0f)h=-Proj4js.common.HALF_PI;else return;var l=a*a+b*b;a=Math.sqrt(l);b=f*Proj4js.common.AD_C; l=Math.sqrt(b*b+l);b/=l;l=a/l;b=f+this.b*this.ep2*b*b*b;var n=a-this.a*this.es*l*l*l;l=Math.sqrt(b*b+n*n);b/=l;l=n/l;n=this.a/Math.sqrt(1-this.es*b*b);f=l>=Proj4js.common.COS_67P5?a/l-n:l<=-Proj4js.common.COS_67P5?a/-l-n:f/b+n*(this.es-1);0==e&&(h=Math.atan(b/l));d.x=g;d.y=h;d.z=f;return d},geocentric_to_wgs84:function(d){if(this.datum_type==Proj4js.common.PJD_3PARAM)d.x+=this.datum_params[0],d.y+=this.datum_params[1],d.z+=this.datum_params[2];else if(this.datum_type==Proj4js.common.PJD_7PARAM){var a= this.datum_params[3],b=this.datum_params[4],f=this.datum_params[5],e=this.datum_params[6],g=e*(f*d.x+d.y-a*d.z)+this.datum_params[1];a=e*(-b*d.x+a*d.y+d.z)+this.datum_params[2];d.x=e*(d.x-f*d.y+b*d.z)+this.datum_params[0];d.y=g;d.z=a}},geocentric_from_wgs84:function(d){if(this.datum_type==Proj4js.common.PJD_3PARAM)d.x-=this.datum_params[0],d.y-=this.datum_params[1],d.z-=this.datum_params[2];else if(this.datum_type==Proj4js.common.PJD_7PARAM){var a=this.datum_params[3],b=this.datum_params[4],f=this.datum_params[5], e=this.datum_params[6],g=(d.x-this.datum_params[0])/e,h=(d.y-this.datum_params[1])/e;e=(d.z-this.datum_params[2])/e;d.x=g+f*h-b*e;d.y=-f*g+h+a*e;d.z=b*g-a*h+e}}}); Proj4js.Point=Proj4js.Class({initialize:function(d,a,b){"object"==typeof d?(this.x=d[0],this.y=d[1],this.z=d[2]||0):"string"==typeof d&&"undefined"==typeof a?(d=d.split(","),this.x=parseFloat(d[0]),this.y=parseFloat(d[1]),this.z=parseFloat(d[2])||0):(this.x=d,this.y=a,this.z=b||0)},clone:function(){return new Proj4js.Point(this.x,this.y,this.z)},toString:function(){return"x="+this.x+",y="+this.y},toShortString:function(){return this.x+", "+this.y}}); Proj4js.PrimeMeridian={greenwich:0,lisbon:-9.131906111111,paris:2.337229166667,bogota:-74.080916666667,madrid:-3.687938888889,rome:12.452333333333,bern:7.439583333333,jakarta:106.807719444444,ferro:-17.666666666667,brussels:4.367975,stockholm:18.058277777778,athens:23.7163375,oslo:10.722916666667}; Proj4js.Ellipsoid={MERIT:{a:6378137,rf:298.257,ellipseName:"MERIT 1983"},SGS85:{a:6378136,rf:298.257,ellipseName:"Soviet Geodetic System 85"},GRS80:{a:6378137,rf:298.257222101,ellipseName:"GRS 1980(IUGG, 1980)"},IAU76:{a:6378140,rf:298.257,ellipseName:"IAU 1976"},airy:{a:6377563.396,b:6356256.91,ellipseName:"Airy 1830"},"APL4.":{a:6378137,rf:298.25,ellipseName:"Appl. Physics. 1965"},NWL9D:{a:6378145,rf:298.25,ellipseName:"Naval Weapons Lab., 1965"},mod_airy:{a:6377340.189,b:6356034.446,ellipseName:"Modified Airy"}, andrae:{a:6377104.43,rf:300,ellipseName:"Andrae 1876 (Den., Iclnd.)"},aust_SA:{a:6378160,rf:298.25,ellipseName:"Australian Natl & S. Amer. 1969"},GRS67:{a:6378160,rf:298.247167427,ellipseName:"GRS 67(IUGG 1967)"},bessel:{a:6377397.155,rf:299.1528128,ellipseName:"Bessel 1841"},bess_nam:{a:6377483.865,rf:299.1528128,ellipseName:"Bessel 1841 (Namibia)"},clrk66:{a:6378206.4,b:6356583.8,ellipseName:"Clarke 1866"},clrk80:{a:6378249.145,rf:293.4663,ellipseName:"Clarke 1880 mod."},CPM:{a:6375738.7,rf:334.29, ellipseName:"Comm. des Poids et Mesures 1799"},delmbr:{a:6376428,rf:311.5,ellipseName:"Delambre 1810 (Belgium)"},engelis:{a:6378136.05,rf:298.2566,ellipseName:"Engelis 1985"},evrst30:{a:6377276.345,rf:300.8017,ellipseName:"Everest 1830"},evrst48:{a:6377304.063,rf:300.8017,ellipseName:"Everest 1948"},evrst56:{a:6377301.243,rf:300.8017,ellipseName:"Everest 1956"},evrst69:{a:6377295.664,rf:300.8017,ellipseName:"Everest 1969"},evrstSS:{a:6377298.556,rf:300.8017,ellipseName:"Everest (Sabah & Sarawak)"}, fschr60:{a:6378166,rf:298.3,ellipseName:"Fischer (Mercury Datum) 1960"},fschr60m:{a:6378155,rf:298.3,ellipseName:"Fischer 1960"},fschr68:{a:6378150,rf:298.3,ellipseName:"Fischer 1968"},helmert:{a:6378200,rf:298.3,ellipseName:"Helmert 1906"},hough:{a:6378270,rf:297,ellipseName:"Hough"},intl:{a:6378388,rf:297,ellipseName:"International 1909 (Hayford)"},kaula:{a:6378163,rf:298.24,ellipseName:"Kaula 1961"},lerch:{a:6378139,rf:298.257,ellipseName:"Lerch 1979"},mprts:{a:6397300,rf:191,ellipseName:"Maupertius 1738"}, new_intl:{a:6378157.5,b:6356772.2,ellipseName:"New International 1967"},plessis:{a:6376523,rf:6355863,ellipseName:"Plessis 1817 (France)"},krass:{a:6378245,rf:298.3,ellipseName:"Krassovsky, 1942"},SEasia:{a:6378155,b:6356773.3205,ellipseName:"Southeast Asia"},walbeck:{a:6376896,b:6355834.8467,ellipseName:"Walbeck"},WGS60:{a:6378165,rf:298.3,ellipseName:"WGS 60"},WGS66:{a:6378145,rf:298.25,ellipseName:"WGS 66"},WGS72:{a:6378135,rf:298.26,ellipseName:"WGS 72"},WGS84:{a:6378137,rf:298.257223563,ellipseName:"WGS 84"}, sphere:{a:6370997,b:6370997,ellipseName:"Normal Sphere (r=6370997)"}}; Proj4js.Datum={WGS84:{towgs84:"0,0,0",ellipse:"WGS84",datumName:"WGS84"},GGRS87:{towgs84:"-199.87,74.79,246.62",ellipse:"GRS80",datumName:"Greek_Geodetic_Reference_System_1987"},NAD83:{towgs84:"0,0,0",ellipse:"GRS80",datumName:"North_American_Datum_1983"},NAD27:{nadgrids:"@conus,@alaska,@ntv2_0.gsb,@ntv1_can.dat",ellipse:"clrk66",datumName:"North_American_Datum_1927"},potsdam:{towgs84:"606.0,23.0,413.0",ellipse:"bessel",datumName:"Potsdam Rauenberg 1950 DHDN"},carthage:{towgs84:"-263.0,6.0,431.0", ellipse:"clark80",datumName:"Carthage 1934 Tunisia"},hermannskogel:{towgs84:"653.0,-212.0,449.0",ellipse:"bessel",datumName:"Hermannskogel"},ire65:{towgs84:"482.530,-130.596,564.557,-1.042,-0.214,-0.631,8.15",ellipse:"mod_airy",datumName:"Ireland 1965"},nzgd49:{towgs84:"59.47,-5.04,187.44,0.47,-0.1,1.024,-4.5993",ellipse:"intl",datumName:"New Zealand Geodetic Datum 1949"},OSGB36:{towgs84:"446.448,-125.157,542.060,0.1502,0.2470,0.8421,-20.4894",ellipse:"airy",datumName:"Airy 1830"}}; Proj4js.WGS84=new Proj4js.Proj("WGS84");Proj4js.Datum.OSB36=Proj4js.Datum.OSGB36;Proj4js.wktProjections={"Lambert Tangential Conformal Conic Projection":"lcc",Mercator:"merc","Popular Visualisation Pseudo Mercator":"merc",Mercator_1SP:"merc",Transverse_Mercator:"tmerc","Transverse Mercator":"tmerc","Lambert Azimuthal Equal Area":"laea","Universal Transverse Mercator System":"utm"}; Proj4js.Proj.aea={init:function(){Math.abs(this.lat1+this.lat2)Proj4js.common.EPSLN?(this.ms1*this.ms1-this.ms2*this.ms2)/(this.qs2-this.qs1):this.con,this.c=this.ms1*this.ms1+this.ns0*this.qs1,this.rh=this.a*Math.sqrt(this.c-this.ns0*this.qs0)/ this.ns0)},forward:function(d){var a=d.x,b=d.y;this.sin_phi=Math.sin(b);this.cos_phi=Math.cos(b);b=Proj4js.common.qsfnz(this.e3,this.sin_phi,this.cos_phi);b=this.a*Math.sqrt(this.c-this.ns0*b)/this.ns0;var f=this.ns0*Proj4js.common.adjust_lon(a-this.long0);a=b*Math.sin(f)+this.x0;b=this.rh-b*Math.cos(f)+this.y0;d.x=a;d.y=b;return d},inverse:function(d){var a,b;d.x-=this.x0;d.y=this.rh-d.y+this.y0;0<=this.ns0?(a=Math.sqrt(d.x*d.x+d.y*d.y),b=1):(a=-Math.sqrt(d.x*d.x+d.y*d.y),b=-1);var f=0;0!=a&&(f= Math.atan2(b*d.x,b*d.y));b=a*this.ns0/this.a;a=(this.c-b*b)/this.ns0;1E-10<=this.e3?(b=1-.5*(1-this.es)*Math.log((1-this.e3)/(1+this.e3))/this.e3,b=1E-10=n;n++)if(b=Math.sin(h),f=Math.cos(h), e=d*b,g=1-e*e,b=.5*g*g/f*(a/(1-l)-b/g+.5/d*Math.log((1-e)/(1+e))),h+=b,1E-7>=Math.abs(b))return h;Proj4js.reportError("aea:phi1z:Convergence error");return null}}; Proj4js.Proj.sterea={dependsOn:"gauss",init:function(){Proj4js.Proj.gauss.init.apply(this);this.rc?(this.sinc0=Math.sin(this.phic0),this.cosc0=Math.cos(this.phic0),this.R2=2*this.rc,this.title||(this.title="Oblique Stereographic Alternative")):Proj4js.reportError("sterea:init:E_ERROR_0")},forward:function(d){d.x=Proj4js.common.adjust_lon(d.x-this.long0);Proj4js.Proj.gauss.forward.apply(this,[d]);var a=Math.sin(d.y);var b=Math.cos(d.y);var f=Math.cos(d.x);var e=this.k0*this.R2/(1+this.sinc0*a+this.cosc0* b*f);d.x=e*b*Math.sin(d.x);d.y=e*(this.cosc0*a-this.sinc0*b*f);d.x=this.a*d.x+this.x0;d.y=this.a*d.y+this.y0;return d},inverse:function(d){var a,b,f,e;d.x=(d.x-this.x0)/this.a;d.y=(d.y-this.y0)/this.a;d.x/=this.k0;d.y/=this.k0;(e=Math.sqrt(d.x*d.x+d.y*d.y))?(f=2*Math.atan2(e,this.R2),a=Math.sin(f),b=Math.cos(f),f=Math.asin(b*this.sinc0+d.y*a*this.cosc0/e),a=Math.atan2(d.x*a,e*this.cosc0*b-d.y*this.sinc0*a)):(f=this.phic0,a=0);d.x=a;d.y=f;Proj4js.Proj.gauss.inverse.apply(this,[d]);d.x=Proj4js.common.adjust_lon(d.x+ this.long0);return d}};function phi4z(d,a,b,f,e,g,h,l,n){var t,k,p,E,H,B;n=g;for(B=1;15>=B;B++)if(t=Math.sin(n),p=Math.tan(n),l=p*Math.sqrt(1-d*t*t),k=Math.sin(2*n),E=a*n-b*k+f*Math.sin(4*n)-e*Math.sin(6*n),H=a-2*b*Math.cos(2*n)+4*f*Math.cos(4*n)-6*e*Math.cos(6*n),t=2*E+l*(E*E+h)-2*g*(l*E+1),p=d*k*(E*E+h-2*g*E)/(2*l),l=2*(g-E)*(l*H-2/k)-2*H,t/=p+l,n+=t,1E-10>=Math.abs(t))return n;Proj4js.reportError("phi4z: No convergence");return null} function e4fn(d){var a=1+d;d=1-d;return Math.sqrt(Math.pow(a,a)*Math.pow(d,d))} Proj4js.Proj.poly={init:function(){0==this.lat0&&(this.lat0=90);this.temp=this.b/this.a;this.es=1-Math.pow(this.temp,2);this.e=Math.sqrt(this.es);this.e0=Proj4js.common.e0fn(this.es);this.e1=Proj4js.common.e1fn(this.es);this.e2=Proj4js.common.e2fn(this.es);this.e3=Proj4js.common.e3fn(this.es);this.ml0=Proj4js.common.mlfn(this.e0,this.e1,this.e2,this.e3,this.lat0)},forward:function(d){var a,b,f;var e=d.y;var g=Proj4js.common.adjust_lon(d.x-this.long0);1E-7>=Math.abs(e)?(f=this.x0+this.a*g,a=this.y0- this.a*this.ml0):(a=Math.sin(e),g=Math.cos(e),e=Proj4js.common.mlfn(this.e0,this.e1,this.e2,this.e3,e),b=Proj4js.common.msfnz(this.e,a,g),g=a,f=this.x0+this.a*b*Math.sin(g)/a,a=this.y0+this.a*(e-this.ml0+b*(1-Math.cos(g))/a));d.x=f;d.y=a;return d},inverse:function(d){d.x-=this.x0;d.y-=this.y0;var a=this.ml0+d.y/this.a;if(1E-7>=Math.abs(a)){a=d.x/this.a+this.long0;var b=0}else{a=a*a+d.x/this.a*(d.x/this.a);a=phi4z(this.es,this.e0,this.e1,this.e2,this.e3,this.al,a,void 0,b);if(1!=a)return a;a=Proj4js.common.adjust_lon(Proj4js.common.asinz(NaN* d.x/this.a)/Math.sin(b)+this.long0)}d.x=a;d.y=b;return d}}; Proj4js.Proj.equi={init:function(){this.x0||(this.x0=0);this.y0||(this.y0=0);this.lat0||(this.lat0=0);this.long0||(this.long0=0)},forward:function(d){var a=d.y,b=this.x0+this.a*Proj4js.common.adjust_lon(d.x-this.long0)*Math.cos(this.lat0);a=this.y0+this.a*a;this.t1=b;this.t2=Math.cos(this.lat0);d.x=b;d.y=a;return d},inverse:function(d){d.x-=this.x0;d.y-=this.y0;var a=d.y/this.a;Math.abs(a)>Proj4js.common.HALF_PI&&Proj4js.reportError("equi:Inv:DataError");var b=Proj4js.common.adjust_lon(this.long0+ d.x/(this.a*Math.cos(this.lat0)));d.x=b;d.y=a}}; Proj4js.Proj.merc={init:function(){this.lat_ts&&(this.k0=this.sphere?Math.cos(this.lat_ts):Proj4js.common.msfnz(this.es,Math.sin(this.lat_ts),Math.cos(this.lat_ts)))},forward:function(d){var a=d.x,b=d.y;if(90b*Proj4js.common.R2D&&180a*Proj4js.common.R2D)return Proj4js.reportError("merc:forward: llInputOutOfRange: "+a+" : "+b),null;if(Math.abs(Math.abs(b)-Proj4js.common.HALF_PI)<=Proj4js.common.EPSLN)return Proj4js.reportError("merc:forward: ll2mAtPoles"),null; this.sphere?(a=this.x0+this.a*this.k0*Proj4js.common.adjust_lon(a-this.long0),b=this.y0+this.a*this.k0*Math.log(Math.tan(Proj4js.common.FORTPI+.5*b))):(b=Proj4js.common.tsfnz(this.e,b,Math.sin(b)),a=this.x0+this.a*this.k0*Proj4js.common.adjust_lon(a-this.long0),b=this.y0-this.a*this.k0*Math.log(b));d.x=a;d.y=b;return d},inverse:function(d){var a=d.x-this.x0,b=d.y-this.y0;if(this.sphere)b=Proj4js.common.HALF_PI-2*Math.atan(Math.exp(-b/this.a*this.k0));else if(b=Math.exp(-b/(this.a*this.k0)),b=Proj4js.common.phi2z(this.e, b),-9999==b)return Proj4js.reportError("merc:inverse: lat = -9999"),null;a=Proj4js.common.adjust_lon(this.long0+a/(this.a*this.k0));d.x=a;d.y=b;return d}};Proj4js.Proj.utm={dependsOn:"tmerc",init:function(){this.zone?(this.lat0=0,this.long0=(6*Math.abs(this.zone)-183)*Proj4js.common.D2R,this.x0=5E5,this.y0=this.utmSouth?1E7:0,this.k0=.9996,Proj4js.Proj.tmerc.init.apply(this),this.forward=Proj4js.Proj.tmerc.forward,this.inverse=Proj4js.Proj.tmerc.inverse):Proj4js.reportError("utm:init: zone must be specified for UTM")}}; Proj4js.Proj.eqdc={init:function(){this.mode||(this.mode=0);this.temp=this.b/this.a;this.es=1-Math.pow(this.temp,2);this.e=Math.sqrt(this.es);this.e0=Proj4js.common.e0fn(this.es);this.e1=Proj4js.common.e1fn(this.es);this.e2=Proj4js.common.e2fn(this.es);this.e3=Proj4js.common.e3fn(this.es);this.sinphi=Math.sin(this.lat1);this.cosphi=Math.cos(this.lat1);this.ms1=Proj4js.common.msfnz(this.e,this.sinphi,this.cosphi);this.ml1=Proj4js.common.mlfn(this.e0,this.e1,this.e2,this.e3,this.lat1);0!=this.mode? (Math.abs(this.lat1+this.lat2)=Proj4js.common.EPSLN?(this.ms1-this.ms2)/(this.ml2-this.ml1):this.sinphi):this.ns=this.sinphi;this.g=this.ml1+this.ms1/this.ns;this.ml0=Proj4js.common.mlfn(this.e0, this.e1,this.e2,this.e3,this.lat0);this.rh=this.a*(this.g-this.ml0)},forward:function(d){var a=d.x,b=this.a*(this.g-Proj4js.common.mlfn(this.e0,this.e1,this.e2,this.e3,d.y)),f=this.ns*Proj4js.common.adjust_lon(a-this.long0);a=this.x0+b*Math.sin(f);b=this.y0+this.rh-b*Math.cos(f);d.x=a;d.y=b;return d},inverse:function(d){d.x-=this.x0;d.y=this.rh-d.y+this.y0;var a,b;0<=this.ns?(b=Math.sqrt(d.x*d.x+d.y*d.y),a=1):(b=-Math.sqrt(d.x*d.x+d.y*d.y),a=-1);var f=0;0!=b&&(f=Math.atan2(a*d.x,a*d.y));a=this.phi3z(this.g- b/this.a,this.e0,this.e1,this.e2,this.e3);f=Proj4js.common.adjust_lon(this.long0+f/this.ns);d.x=f;d.y=a;return d},phi3z:function(d,a,b,f,e){var g;var h=d;for(var l=0;15>l;l++)if(g=(d+b*Math.sin(2*h)-f*Math.sin(4*h)+e*Math.sin(6*h))/a-h,h+=g,1E-10>=Math.abs(g))return h;Proj4js.reportError("PHI3Z-CONV:Latitude failed to converge after 15 iterations");return null}}; Proj4js.Proj.tmerc={init:function(){this.e0=Proj4js.common.e0fn(this.es);this.e1=Proj4js.common.e1fn(this.es);this.e2=Proj4js.common.e2fn(this.es);this.e3=Proj4js.common.e3fn(this.es);this.ml0=this.a*Proj4js.common.mlfn(this.e0,this.e1,this.e2,this.e3,this.lat0)},forward:function(d){var a=d.y,b=Proj4js.common.adjust_lon(d.x-this.long0);var f=Math.sin(a);var e=Math.cos(a);if(this.sphere){var g=e*Math.sin(b);if(1E-10>Math.abs(Math.abs(g)-1))return Proj4js.reportError("tmerc:forward: Point projects into infinity"), 93;var h=.5*this.a*this.k0*Math.log((1+g)/(1-g));f=Math.acos(e*Math.cos(b)/Math.sqrt(1-g*g));0>a&&(f=-f);a=this.a*this.k0*(f-this.lat0)}else{h=e*b;b=Math.pow(h,2);e=this.ep2*Math.pow(e,2);g=Math.tan(a);var l=Math.pow(g,2);f=1-this.es*Math.pow(f,2);f=this.a/Math.sqrt(f);a=this.a*Proj4js.common.mlfn(this.e0,this.e1,this.e2,this.e3,a);h=this.k0*f*h*(1+b/6*(1-l+e+b/20*(5-18*l+Math.pow(l,2)+72*e-58*this.ep2)))+this.x0;a=this.k0*(a-this.ml0+f*g*b*(.5+b/24*(5-l+9*e+4*Math.pow(e,2)+b/30*(61-58*l+Math.pow(l, 2)+600*e-330*this.ep2))))+this.y0}d.x=h;d.y=a;return d},inverse:function(d){if(this.sphere){var a=Math.exp(d.x/(this.a*this.k0));var b=.5*(a-1/a);var f=this.lat0+d.y/(this.a*this.k0);var e=Math.cos(f);var g=Math.sqrt((1-e*e)/(1+b*b));a=Proj4js.common.asinz(g);0>f&&(a=-a);g=0==b&&0==e?this.long0:Proj4js.common.adjust_lon(Math.atan2(b,e)+this.long0)}else{b=d.x-this.x0;var h=d.y-this.y0;a=g=(this.ml0+h/this.k0)/this.a;for(e=0;;e++){f=(g+this.e1*Math.sin(2*a)-this.e2*Math.sin(4*a)+this.e3*Math.sin(6* a))/this.e0-a;a+=f;if(Math.abs(f)<=Proj4js.common.EPSLN)break;if(6<=e)return Proj4js.reportError("tmerc:inverse: Latitude failed to converge"),95}if(Math.abs(a)this.a+1E-7&&Proj4js.reportError("orthoInvDataError");var b=Proj4js.common.asinz(a/this.a);var f=Math.sin(b);var e=Math.cos(b);b=this.long0;Math.abs(a);f=Proj4js.common.asinz(e*this.sin_p14+d.y*f*this.cos_p14/a);a=Math.abs(this.lat0)-Proj4js.common.HALF_PI;Math.abs(a)<=Proj4js.common.EPSLN&&(b=0<=this.lat0?Proj4js.common.adjust_lon(this.long0+Math.atan2(d.x,-d.y)):Proj4js.common.adjust_lon(this.long0-Math.atan2(-d.x,d.y)));Math.sin(f);d.x=b;d.y=f;return d}}; Proj4js.Proj.krovak={init:function(){this.a=6377397.155;this.es=.006674372230614;this.e=Math.sqrt(this.es);this.lat0||(this.lat0=.863937979737193);this.long0||(this.long0=.4334234309119251);this.k0||(this.k0=.9999);this.s45=.785398163397448;this.s90=2*this.s45;this.fi0=this.lat0;this.e2=this.es;this.e=Math.sqrt(this.e2);this.alfa=Math.sqrt(1+this.e2*Math.pow(Math.cos(this.fi0),4)/(1-this.e2));this.uq=1.04216856380474;this.u0=Math.asin(Math.sin(this.fi0)/this.alfa);this.g=Math.pow((1+this.e*Math.sin(this.fi0))/ (1-this.e*Math.sin(this.fi0)),this.alfa*this.e/2);this.k=Math.tan(this.u0/2+this.s45)/Math.pow(Math.tan(this.fi0/2+this.s45),this.alfa)*this.g;this.k1=this.k0;this.n0=this.a*Math.sqrt(1-this.e2)/(1-this.e2*Math.pow(Math.sin(this.fi0),2));this.s0=1.37008346281555;this.n=Math.sin(this.s0);this.ro0=this.k1*this.n0/Math.tan(this.s0);this.ad=this.s90-this.uq},forward:function(d){var a=d.y;var b=Proj4js.common.adjust_lon(d.x-this.long0);var f=Math.pow((1+this.e*Math.sin(a))/(1-this.e*Math.sin(a)),this.alfa* this.e/2);f=2*(Math.atan(this.k*Math.pow(Math.tan(a/2+this.s45),this.alfa)/f)-this.s45);a=-b*this.alfa;b=Math.asin(Math.cos(this.ad)*Math.sin(f)+Math.sin(this.ad)*Math.cos(f)*Math.cos(a));f=this.n*Math.asin(Math.cos(f)*Math.sin(a)/Math.cos(b));b=this.ro0*Math.pow(Math.tan(this.s0/2+this.s45),this.n)/Math.pow(Math.tan(b/2+this.s45),this.n);d.y=b*Math.cos(f);d.x=b*Math.sin(f);this.czech&&(d.y*=-1,d.x*=-1);return d},inverse:function(d){var a=d.x;d.x=d.y;d.y=a;this.czech&&(d.y*=-1,d.x*=-1);a=Math.sqrt(d.x* d.x+d.y*d.y);var b=Math.atan2(d.y,d.x)/Math.sin(this.s0);var f=2*(Math.atan(Math.pow(this.ro0/a,1/this.n)*Math.tan(this.s0/2+this.s45))-this.s45);a=Math.asin(Math.cos(this.ad)*Math.sin(f)-Math.sin(this.ad)*Math.cos(f)*Math.cos(b));b=Math.asin(Math.cos(f)*Math.sin(b)/Math.cos(a));d.x=this.long0-b/this.alfa;b=a;var e=f=0;do d.y=2*(Math.atan(Math.pow(this.k,-1/this.alfa)*Math.pow(Math.tan(a/2+this.s45),1/this.alfa)*Math.pow((1+this.e*Math.sin(b))/(1-this.e*Math.sin(b)),this.e/2))-this.s45),1E-10>Math.abs(b- d.y)&&(f=1),b=d.y,e+=1;while(0==f&&15>e);return 15<=e?(Proj4js.reportError("PHI3Z-CONV:Latitude failed to converge after 15 iterations"),null):d}}; Proj4js.Proj.somerc={init:function(){var d=this.lat0;this.lambda0=this.long0;var a=Math.sin(d),b=this.a,f=1/this.rf;f=2*f-Math.pow(f,2);var e=this.e=Math.sqrt(f);this.R=this.k0*b*Math.sqrt(1-f)/(1-f*Math.pow(a,2));this.alpha=Math.sqrt(1+f/(1-f)*Math.pow(Math.cos(d),4));this.b0=Math.asin(a/this.alpha);this.K=Math.log(Math.tan(Math.PI/4+this.b0/2))-this.alpha*Math.log(Math.tan(Math.PI/4+d/2))+this.alpha*e/2*Math.log((1+e*a)/(1-e*a))},forward:function(d){var a=Math.log(Math.tan(Math.PI/4-d.y/2)),b=this.e/ 2*Math.log((1+this.e*Math.sin(d.y))/(1-this.e*Math.sin(d.y)));b=2*(Math.atan(Math.exp(-this.alpha*(a+b)+this.K))-Math.PI/4);var f=this.alpha*(d.x-this.lambda0);a=Math.atan(Math.sin(f)/(Math.sin(this.b0)*Math.tan(b)+Math.cos(this.b0)*Math.cos(f)));b=Math.asin(Math.cos(this.b0)*Math.sin(b)-Math.sin(this.b0)*Math.cos(b)*Math.cos(f));d.y=this.R/2*Math.log((1+Math.sin(b))/(1-Math.sin(b)))+this.y0;d.x=this.R*a+this.x0;return d},inverse:function(d){var a=(d.x-this.x0)/this.R,b=2*(Math.atan(Math.exp((d.y- this.y0)/this.R))-Math.PI/4),f=Math.asin(Math.cos(this.b0)*Math.sin(b)+Math.sin(this.b0)*Math.cos(b)*Math.cos(a));a=this.lambda0+Math.atan(Math.sin(a)/(Math.cos(this.b0)*Math.cos(a)-Math.sin(this.b0)*Math.tan(b)))/this.alpha;for(var e=f,g=-1E3,h=0;1E-7this.lat0?this.S_POLE:this.N_POLE:d>Proj4js.common.EPSLN?this.OBLIQ:this.EQUIT;this.phits=Math.abs(this.phits);if(this.es)switch(this.mode){case this.N_POLE:case this.S_POLE:Math.abs(this.phits-Proj4js.common.HALF_PI)< Proj4js.common.EPSLN?this.akm1=2*this.k0/Math.sqrt(Math.pow(1+this.e,1+this.e)*Math.pow(1-this.e,1-this.e)):(d=Math.sin(this.phits),this.akm1=Math.cos(this.phits)/Proj4js.common.tsfnz(this.e,this.phits,d),d*=this.e,this.akm1/=Math.sqrt(1-d*d));break;case this.EQUIT:this.akm1=2*this.k0;break;case this.OBLIQ:d=Math.sin(this.lat0);var a=2*Math.atan(this.ssfn_(this.lat0,d,this.e))-Proj4js.common.HALF_PI;d*=this.e;this.akm1=2*this.k0*Math.cos(this.lat0)/Math.sqrt(1-d*d);this.sinX1=Math.sin(a);this.cosX1= Math.cos(a)}else switch(this.mode){case this.OBLIQ:this.sinph0=Math.sin(this.lat0),this.cosph0=Math.cos(this.lat0);case this.EQUIT:this.akm1=2*this.k0;break;case this.S_POLE:case this.N_POLE:this.akm1=Math.abs(this.phits-Proj4js.common.HALF_PI)>=Proj4js.common.EPSLN?Math.cos(this.phits)/Math.tan(Proj4js.common.FORTPI-.5*this.phits):2*this.k0}},forward:function(d){var a=d.x;a=Proj4js.common.adjust_lon(a-this.long0);var b=d.y;if(this.sphere){var f=Math.sin(b);var e=Math.cos(b);var g=Math.cos(a);a=Math.sin(a); switch(this.mode){case this.EQUIT:var h=1+e*g;h<=Proj4js.common.EPSLN&&Proj4js.reportError("stere:forward:Equit");h=this.akm1/h;var l=h*e*a;h*=f;break;case this.OBLIQ:h=1+this.sinph0*f+this.cosph0*e*g;h<=Proj4js.common.EPSLN&&Proj4js.reportError("stere:forward:Obliq");h=this.akm1/h;l=h*e*a;h*=this.cosph0*f-this.sinph0*e*g;break;case this.N_POLE:g=-g,b=-b;case this.S_POLE:Math.abs(b-Proj4js.common.HALF_PI)=g;g++)f*=a,e+=this.A[g]*f;a=e;f=1;var h=0,l=0,n=0;for(g=1;6>=g;g++)e=f*a-h*b,h=h*a+f*b,f=e,l=l+this.B_re[g]*f-this.B_im[g]*h,n=n+this.B_im[g]*f+this.B_re[g]*h;d.x=n*this.a+this.x0;d.y=l*this.a+this.y0;return d},inverse:function(d){for(var a=(d.y-this.y0)/this.a,b=(d.x-this.x0)/this.a,f=1,e=0,g,h=0,l=0,n=1;6>=n;n++)g=f*a-e*b,e=e*a+f*b,f=g,h=h+this.C_re[n]* f-this.C_im[n]*e,l=l+this.C_im[n]*f+this.C_re[n]*e;for(f=0;f=n;n++){var p=t*h-k*l;k=k*h+t*l;t=p;g+=(n-1)*(this.B_re[n]*t-this.B_im[n]*k);e+=(n-1)*(this.B_im[n]*t+this.B_re[n]*k)}t=1;k=0;var E=this.B_re[1],H=this.B_im[1];for(n=2;6>=n;n++)p=t*h-k*l,k=k*h+t*l,t=p,E+=n*(this.B_re[n]*t-this.B_im[n]*k),H+=n*(this.B_im[n]*t+this.B_re[n]*k);l=E*E+H*H;h=(g*E+e*H)/l;l=(e*E-g*H)/l}a=h;b=1;h=0;for(n=1;9>=n;n++)b*=a,h+=this.D[n]*b;n=this.lat0+1E5*h*Proj4js.common.SEC_TO_RAD; d.x=this.long0+l;d.y=n;return d}};Proj4js.Proj.mill={init:function(){},forward:function(d){var a=d.y,b=this.x0+this.a*Proj4js.common.adjust_lon(d.x-this.long0);a=this.y0+1.25*this.a*Math.log(Math.tan(Proj4js.common.PI/4+a/2.5));d.x=b;d.y=a;return d},inverse:function(d){d.x-=this.x0;d.y-=this.y0;var a=Proj4js.common.adjust_lon(this.long0+d.x/this.a),b=2.5*(Math.atan(Math.exp(.8*d.y/this.a))-Proj4js.common.PI/4);d.x=a;d.y=b;return d}}; Proj4js.Proj.gnom={init:function(){this.sin_p14=Math.sin(this.lat0);this.cos_p14=Math.cos(this.lat0);this.infinity_dist=1E3*this.a;this.rc=1},forward:function(d){var a=d.y;var b=Proj4js.common.adjust_lon(d.x-this.long0);var f=Math.sin(a);a=Math.cos(a);var e=Math.cos(b);var g=this.sin_p14*f+this.cos_p14*a*e;0b&&(g=-g);b=this.x0+g;g=Math.abs(g/(Proj4js.common.PI*this.R));a=0<=a?this.y0+Proj4js.common.PI*this.R*Math.sqrt(1-g*g-2*e*g):this.y0-Proj4js.common.PI*this.R*Math.sqrt(1-g*g-2*e*g);d.x=b;d.y=a;return d},inverse:function(d){d.x-=this.x0;d.y-=this.y0;var a=Proj4js.common.PI*this.R;var b=d.x/a;var f=d.y/a;var e=b*b+f*f;var g=-Math.abs(f)*(1+e);var h=g-2*f*f+b*b;var l=-2*g+1+2*f*f+e*e;a=f*f/l+(2*h*h*h/l/l/l-9*g*h/l/l)/27;var n=(g-h*h/3/l)/l;g=2*Math.sqrt(-n/3);a=3*a/n/g;1Math.abs(b-d.y))break;d.y=b}if(!e)return Proj4js.reportError("gauss:inverse:convergence failed"),null;d.x=a;d.y=b;return d}}; Proj4js.Proj.omerc={init:function(){this.mode||(this.mode=0);this.lon1||(this.lon1=0,this.mode=1);this.lon2||(this.lon2=0);this.lat2||(this.lat2=0);var d=1-Math.pow(this.b/this.a,2);Math.sqrt(d);this.sin_p20=Math.sin(this.lat0);this.cos_p20=Math.cos(this.lat0);this.con=1-this.es*this.sin_p20*this.sin_p20;this.com=Math.sqrt(1-d);this.bl=Math.sqrt(1+this.es*Math.pow(this.cos_p20,4)/(1-d));this.al=this.a*this.bl*this.k0*this.com/this.con;Math.abs(this.lat0) Proj4js.common.EPSLN&&Math.abs(this.con-Proj4js.common.HALF_PI)>Proj4js.common.EPSLN?(this.singam=Math.sin(this.gama),this.cosgam=Math.cos(this.gama),this.sinaz=Math.sin(this.alpha),this.cosaz=Math.cos(this.alpha),this.u=0<=this.lat0?this.al/this.bl*Math.atan(Math.sqrt(this.d*this.d-1)/this.cosaz):-(this.al/this.bl)*Math.atan(Math.sqrt(this.d*this.d-1)/this.cosaz)):Proj4js.reportError("omerc:Init:DataError")):(this.sinphi=Math.sin(this.at1),this.ts1=Proj4js.common.tsfnz(this.e,this.lat1,this.sinphi), this.sinphi=Math.sin(this.lat2),this.ts2=Proj4js.common.tsfnz(this.e,this.lat2,this.sinphi),this.h=Math.pow(this.ts1,this.bl),this.l=Math.pow(this.ts2,this.bl),this.f=this.el/this.h,this.g=.5*(this.f-1/this.f),this.j=(this.el*this.el-this.l*this.h)/(this.el*this.el+this.l*this.h),this.p=(this.l-this.h)/(this.l+this.h),this.dlon=this.lon1-this.lon2,this.dlon<-Proj4js.common.PI&&(this.lon2-=2*Proj4js.common.PI),this.dlon>Proj4js.common.PI&&(this.lon2+=2*Proj4js.common.PI),this.dlon=this.lon1-this.lon2, this.longc=.5*(this.lon1+this.lon2)-Math.atan(this.j*Math.tan(.5*this.bl*this.dlon)/this.p)/this.bl,this.dlon=Proj4js.common.adjust_lon(this.lon1-this.longc),this.gama=Math.atan(Math.sin(this.bl*this.dlon)/this.g),this.alpha=Proj4js.common.asinz(this.d*Math.sin(this.gama)),Math.abs(this.lat1-this.lat2)<=Proj4js.common.EPSLN?Proj4js.reportError("omercInitDataError"):this.con=Math.abs(this.lat1),this.con<=Proj4js.common.EPSLN||Math.abs(this.con-Proj4js.common.HALF_PI)<=Proj4js.common.EPSLN?Proj4js.reportError("omercInitDataError"): Math.abs(Math.abs(this.lat0)-Proj4js.common.HALF_PI)<=Proj4js.common.EPSLN&&Proj4js.reportError("omercInitDataError"),this.singam=Math.sin(this.gam),this.cosgam=Math.cos(this.gam),this.sinaz=Math.sin(this.alpha),this.cosaz=Math.cos(this.alpha),this.u=0<=this.lat0?this.al/this.bl*Math.atan(Math.sqrt(this.d*this.d-1)/this.cosaz):-(this.al/this.bl)*Math.atan(Math.sqrt(this.d*this.d-1)/this.cosaz))},forward:function(d){var a;var b=d.x;var f=d.y;var e=Math.sin(f);var g=Proj4js.common.adjust_lon(b-this.longc); b=Math.sin(this.bl*g);Math.abs(Math.abs(f)-Proj4js.common.HALF_PI)>Proj4js.common.EPSLN?(e=Proj4js.common.tsfnz(this.e,f,e),e=this.el/Math.pow(e,this.bl),a=.5*(e-1/e),e=(a*this.singam-b*this.cosgam)/(.5*(e+1/e)),f=Math.cos(this.bl*g),1E-7>Math.abs(f)?b=this.al*this.bl*g:(b=this.al*Math.atan((a*this.cosgam+b*this.singam)/f)/this.bl,0>f&&(b+=Proj4js.common.PI*this.al/this.bl))):(e=0<=f?this.singam:-this.singam,b=this.al*f/this.bl);Math.abs(Math.abs(e)-1)<=Proj4js.common.EPSLN&&Proj4js.reportError("omercFwdInfinity"); g=.5*this.al*Math.log((1-e)/(1+e))/this.bl;b-=this.u;e=this.y0+b*this.cosaz-g*this.sinaz;d.x=this.x0+g*this.cosaz+b*this.sinaz;d.y=e;return d},inverse:function(d){d.x-=this.x0;d.y-=this.y0;var a=d.x*this.cosaz-d.y*this.sinaz;var b=d.y*this.cosaz+d.x*this.sinaz;b+=this.u;var f=Math.exp(-this.bl*a/this.al);a=.5*(f-1/f);f=.5*(f+1/f);b=Math.sin(this.bl*b/this.al);var e=(b*this.cosgam+a*this.singam)/f;Math.abs(Math.abs(e)-1)<=Proj4js.common.EPSLN?(a=this.longc,e=0<=e?Proj4js.common.HALF_PI:-Proj4js.common.HALF_PI): (f=1/this.bl,e=Math.pow(this.el/Math.sqrt((1+e)/(1-e)),f),e=Proj4js.common.phi2z(this.e,e),a=this.longc-Math.atan2(a*this.cosgam-b*this.singam,f)/this.bl,a=Proj4js.common.adjust_lon(a));d.x=a;d.y=e;return d}}; Proj4js.Proj.lcc={init:function(){this.lat2||(this.lat2=this.lat0);this.k0||(this.k0=1);if(Math.abs(this.lat1+this.lat2)Proj4js.common.EPSLN?Math.log(a/e)/Math.log(b/f):d;this.f0=a/(this.ns*Math.pow(b,this.ns));this.rh=this.a*this.f0*Math.pow(g,this.ns);this.title||(this.title="Lambert Conformal Conic")}},forward:function(d){var a=d.x,b=d.y;if(!(90>=b&&-90<=b&&180>=a&&-180<=a))return Proj4js.reportError("lcc:forward: llInputOutOfRange: "+a+" : "+b),null;var f=Math.abs(Math.abs(b)-Proj4js.common.HALF_PI);if(f>Proj4js.common.EPSLN)b=Proj4js.common.tsfnz(this.e, b,Math.sin(b)),b=this.a*this.f0*Math.pow(b,this.ns);else{f=b*this.ns;if(0>=f)return Proj4js.reportError("lcc:forward: No Projection"),null;b=0}a=this.ns*Proj4js.common.adjust_lon(a-this.long0);d.x=this.k0*b*Math.sin(a)+this.x0;d.y=this.k0*(this.rh-b*Math.cos(a))+this.y0;return d},inverse:function(d){var a,b,f=(d.x-this.x0)/this.k0,e=this.rh-(d.y-this.y0)/this.k0;0this.lat0?this.S_POLE:this.N_POLE:Math.abs(d)h){Proj4js.reportError("aeqd:Fwd:PointError");return}}else b=Math.acos(h),b/=Math.sin(b);d.x=this.x0+this.a*b*e*Math.sin(a);d.y=this.y0+this.a*b*(this.cos_p12*f-this.sin_p12*e*g);return d}, inverse:function(d){d.x-=this.x0;d.y-=this.y0;var a=Math.sqrt(d.x*d.x+d.y*d.y);if(a>2*Proj4js.common.HALF_PI*this.a)Proj4js.reportError("aeqdInvDataError");else{var b=a/this.a,f=Math.sin(b);b=Math.cos(b);var e=this.long0;if(Math.abs(a)<=Proj4js.common.EPSLN)var g=this.lat0;else{g=Proj4js.common.asinz(b*this.sin_p12+d.y*f*this.cos_p12/a);var h=Math.abs(this.lat0)-Proj4js.common.HALF_PI;Math.abs(h)<=Proj4js.common.EPSLN?e=0<=this.lat0?Proj4js.common.adjust_lon(this.long0+Math.atan2(d.x,-d.y)):Proj4js.common.adjust_lon(this.long0- Math.atan2(-d.x,d.y)):(h=b-this.sin_p12*Math.sin(g),Math.abs(h)Proj4js.common.PI&&(b=Proj4js.common.PI);a=(2*a+Math.sin(2*a))/Proj4js.common.PI;1R?0:Math.floor((R-Y)/aa)-1;idxRange={lowerX:S,upperX:ea,lowerY:R,upperY:R+Math.ceil(Math.abs(q-Y)/aa)};for(aa=idxRange.lowerY;aaO/2)){M=U.TileMatrix[Y].TopLeftCorner;var F=parseFloat(M.split(" ")[0]);q=parseFloat(M.split(" ")[1]);M=E.FromMapPoint(F,q);var z=E.ToMapPoint(0,0),D=E.ToMapPoint(E.getClientWidth(),E.getClientHeight());m=z.xq?0:Math.floor((q-h)/O);var A=u+Math.ceil(Math.abs(n-h)/O);var K=z.xq?0:Math.floor((q-z.y)/O);m=Math.max(K,m);w=Math.min(F,w);F=Math.max(q,u);O=Math.min(q+Math.ceil(Math.abs(D.y-z.y)/O),A);if(G!=m||J!=w||C!=F||L!=O||Y!=Q){G=m;J=w;C=F;L=O;Q=Y;parseFloat(U.TileMatrix[Y].MatrixWidth);parseFloat(U.TileMatrix[Y].MatrixHeight);z=[];A=D=0;for(u=F;u<=O;u++){z.push([]);for(K=m;K<=w;K++){F=M.x+256*K;q=M.y+256*u;var S=document.createElement("img");S.style.display="none";S.onload=function(){var R=this,aa=0;R.style.opacity=aa;var ea=I/7, da=setInterval(function(){aa>=I?(S.style.filter="alpha(opacity="+100*I+")",R.style.opacity=I,clearInterval(da)):(R.style.opacity=aa,R.style.filter="alpha(opacity="+100*aa+")",aa+=ea)},33);R.style.filter="alpha(opacity=0)";this.style.display="block"};S.xIdx=K;S.yIdx=u;S.style.position="absolute";S.style.left=F+"px";S.style.top=q+"px";S.galleryImg=!1;S.hideFocus=!0;S.style.MozUserSelect="none";S.border="0px";z[A].push(S);S.src=d+"?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&Layer="+b.layer+"&Style=default&Format=image/png&TileMatrixSet="+ b.matrixSet+"&TileMatrix="+U.TileMatrix[Y]["ows:Identifier"]+"&TileRow="+u+"&TileCol="+K;p.appendChild(S);S.style.opacity=I;S.style.filter="alpha(opacity="+100*I+")";D++}A++}if(0 B.indexOf("3826")&&(0<=B.indexOf("3825")?(M=TGOS.TWD97toTWD97_119(M.x,M.y),q=TGOS.TWD97toTWD97_119(q.x,q.y)):0<=B.indexOf("4326")&&(M=TGOS.TWD97toWGS84(M.x,M.y),q=TGOS.TWD97toWGS84(q.x,q.y)));break;case TGOS.TGCoordSys.EPSG3825:0>B.indexOf("3825")&&(0<=B.indexOf("3826")?(M=TGOS.TWD97_119toTWD97(M.x,M.y),q=TGOS.TWD97_119toTWD97(q.x,q.y)):0<=B.indexOf("4326")&&(M=TGOS.TWD97_119toWGS84(M.x,M.y),q=TGOS.TWD97_119toWGS84(q.x,q.y)))}var m=M.x,F=q.y,z=q.x,D=M.y;"1.3.0"==H&&0>B.indexOf("CRS:84")&&0<=B.indexOf("EPSG:4326")&& (m=q.y,F=M.x,z=M.y,D=q.x);O=V+"?BBOX="+(m+","+F+","+z+","+D)+"&WIDTH="+O+"&HEIGHT="+Y+"&SIZE="+O+","+Y;O+="&"+G.join("&");n&&(O=n+"?"+O);return O}}function g(){if(h){var O=U.getClientWidth(),Y=U.getClientHeight(),M=U.ToMapPoint(0,0),q=U.ToMapPoint(O,Y);console.log(M);console.log(q);return{left:M.x,top:M.y,right:q.x,bottom:q.y,width:O,height:Y}}}var h=null,l=!0,n,t="auto",k,p=1;h=b.map;var E=h.getPanes().overlayviewLayer;b&&(void 0!==b.opacity&&"number"==typeof b.opacity&&(p=b.opacity),void 0!==b.visible&& "boolean"==typeof b.visible&&(l=b.visible),void 0!==b.zIndex&&"number"==typeof b.zIndex&&(t=b.zIndex),void 0!==b.container&&(E=b.container),void 0!==b.proxy&&(n=0O?M=E.firstChild:O>=Y||(M=E.childNodes[O]));E.removeChild(layerContainer);M?E.insertBefore(layerContainer,M):E.appendChild(layerContainer)}};this.RemoveSelf=function(){E&& Q&&E.removeChild(Q)};this.getLayerId=function(){return layerID};this.getNode=function(){return Q};this.getDefaultViewport=function(){};this.getUrl=function(){return V};this.removeWmsLayer=function(){h.removeLayer(this)};this.getZIndex=function(){return t};this.setZIndex=function(O){t=O;Q&&(Q.style.zIndex=t)};this.getWmsVisible=function(){return this.getVisible()};this.getVisible=function(){return l};this.setWmsVisible=function(O){this.setVisible(O)};this.setVisible=function(O){l=O;Q&&(Q.style.display= l?"block":"none")};this.putVisible=function(O){this.setVisible(O)};this.setProxy=function(O){O&&(n=0da.x?da.x=0:da.x>p.getClientWidth()&&(da.x=p.getClientWidth());0>da.y?da.y=0:da.y>p.getClientHeight()&&(da.y=p.getClientHeight());0>fa.x?fa.x=0:fa.x>p.getClientWidth()&&(fa.x=p.getClientWidth());0>fa.y?fa.y=0:fa.y>p.getClientHeight()&&(fa.y=p.getClientHeight());if(!(da.x>fa.x||da.y>fa.y)){var ka=p.ToMapPoint(da.x,da.y),pa=p.ToMapPoint(fa.x,fa.y);F=ka.x;z=ka.y;D=pa.x;w=pa.y;nWidth=parseInt(fa.x-da.x);nHeight=parseInt(fa.y-da.y);"MSIE"==DeviceTest()?AttachEvent(A, "readystatechange",aa,!1):AttachEvent(A,"load",aa,!1);Q==U&&(da="?"+O.join("&"),"97"!=h&&(fa=n.Inverse(t,new CPoint3(F,z,0)),ka=n.Inverse(t,new CPoint3(D,w,0)),F=fa.X,z=fa.Y,D=ka.X,w=ka.Y),da+="&BBOX="+F+","+w+","+D+","+z+"&WIDTH="+nWidth+"&HEIGHT="+nHeight,A.src=I+da)}}};var ea=function(da,fa){S=fa};this.CreateLegend=function(da){if(1z.x?z.x=0:z.x>g.getClientWidth()&&(z.x=g.getClientWidth());0>z.y?z.y=0:z.y>g.getClientHeight()&&(z.y=g.getClientHeight());0>D.x?D.x=0:D.x>g.getClientWidth()&&(D.x=g.getClientWidth());0>D.y?D.y=0:D.y>g.getClientHeight()&&(D.y=g.getClientHeight());if(!(z.x>D.x||z.y>D.y)){var w=g.ToMapPoint(z.x,z.y),u=g.ToMapPoint(D.x,D.y);C=w.x;L=w.y;I=u.x;Q=u.y;nWidth=parseInt(D.x- z.x);nHeight=parseInt(D.y-z.y);z="/GetImage?V="+U+"&S="+V.valueOf()+"&Width="+nWidth+"&Height="+nHeight+"&Left="+C+"&Top="+L+"&Right="+I+"&Bottom="+Q;"MSIE"==DeviceTest()?AttachEvent(O,"readystatechange",q,!1):AttachEvent(O,"load",q,!1);O.src=a+z}}};var m=function(z,D){M=D};this.CreateLegend=function(z){if(1=a?b/-a-e:d.Z/f-e*(1-this.es))}; function TransverseMercatorProjection(d,a,b,f,e){function g(h,l,n,t){var k,p=(k=t*t)*(.46875-t*(.013020833333333334+.007120768229166667*t)),E=(k*=t)*(.3645833333333333-.005696614583333333*t);n*=l;l*=l;return(1-t*(.25+t*(.046875+t*(.01953125+.01068115234375*t))))*h-n*(t*(.75-t*(.046875+t*(.01953125+.01068115234375*t)))+l*(p+l*(E+l*k*t*.3076171875)))}this.centralMeridian=d;this.falseEasting=a;this.falseNorthing=b;this.latitudeOfOrigin=f;this.scaleFactor=e;this.Forward=function(h,l){l=CPoint3((l.X-d)* Math.PI/180,l.Y*Math.PI/180,l.Z);var n=Math.sin(l.Y),t=Math.cos(l.Y),k=1E-10Math.abs(B))break}n=p;t=Math.PI/2;Math.abs(n)>=t?l=new CPoint3(0,0>l.Y?-t:t,l.Z):(E=Math.sin(n),t=Math.cos(n),k=1E-10=Math.abs(Math.abs(l.Y)-e)?null:new CPoint3(l.X,Math.log(Math.tan(g+.5*l.Y)),l.Z);else if(1E-10>=Math.abs(Math.abs(l.Y)-e))l=null;else{var n=l.X,t=Math,k=t.log,p=l.Y,E=Math.sin(l.Y),H=Math.sqrt(h.es);E*=H;t=-k.call(t,Math.tan(.5*(e-p))/Math.pow((1-E)/(1+E),.5*H));l=new CPoint3(n,t,l.Z)}l.X= l.X*f*h.SemiMajorAxis+a;l.Y=l.Y*f*h.SemiMajorAxis+b;return l};this.Inverse=function(h,l){l=CPoint3((l.X-a)/h.SemiMajorAxis/f,(l.Y-b)/h.SemiMajorAxis/f,l.Z);if(0==h.es)l=new CPoint3(l.X,e-2*Math.atan(Math.exp(-l.Y)),l.Z);else{var n=Math.exp(-l.Y);h=Math.sqrt(h.es);var t=.5*h,k=e-2*Math.atan(n);i=15;do{var p=h*Math.sin(k);p=e-2*Math.atan(n*Math.pow((1-p)/(1+p),t))-k;k+=p}while(1E-10l-1?l-1:0>n?0:n;if((n>=l||0>n)&&g==t)return!1;g= t;h=Math.pow(2,g);return!0};this.getScale=function(){return f*h};this.putScale=function(n){this.putMapLevel(Math.log(n/f)/Math.LN2)};this.getScaleX=function(){return f*h};this.getScaleY=function(){return e*h}} function MapBase(d,a){var b=0,f=0,e=0,g=0,h=null;var l=[];var n=[];var t=null;h=a;var k=d.ownerDocument.createElement("div");d.appendChild(k);k.style.position="absolute";k.style.overflow="hidden";k.style.left="0px";k.style.top="0px";k.style.width="100%";k.style.height="100%";k.style.zIndex=0;var p=k.ownerDocument.createElement("div");k.appendChild(p);p.style.position="absolute";p.style.left="0px";p.style.top="0px";p.style.width="100%";p.style.height="100%";p.style.zIndex=0;b=Number(p.clientWidth); f=Number(p.clientHeight);var E,H=FuncAdapter(this,function(){if(b!=Number(p.clientWidth)||f!=Number(p.clientHeight))E&&clearTimeout(E),E=setTimeout(FuncAdapter(this,function(){this.RefreshMap(!0,!0)}),1E3),this.RefreshMap(!1,!1)});AttachEvent(p,"resize",H,!1);this.setColor=function(I){p.style.background=I};this.FinalRelease=function(){this.SelectMapTool(null);this.RemoveAllElements();DetachEvent(p,"resize",H,!1);k.removeChild(k)};this.getHObject=function(){return p};this.getHPackage=function(){return k}; this.getClientWidth=function(){return b};this.getClientHeight=function(){return f};this.getCenterX=function(){return e};this.putCenterX=function(I){e=I};this.getCenterY=function(){return g};this.putCenterY=function(I){g=I};this.getTransformation=function(){return h};this.putScale=function(I){h=I};this.getScale=function(){return h.getScale()};this.putScale=function(I){h.putScale(I)};this.getCellSizeX=function(){return this.ToMapDistX(1)};this.getCellSizeY=function(){return this.ToMapDistY(1)};this.MoveMapTo= function(I,Q){this.putCenterX(I);this.putCenterY(Q)};this.ZoomMapTo=function(I){null!=I.left&&null!=I.top&&null!=I.right&&null!=I.bottom&&(this.MoveMapTo((I.right+I.left)/2,(I.bottom+I.top)/2),this.putScale(Math.min(Math.abs(b/(I.right-I.left)),Math.abs(f/(I.bottom-I.top)))))};this.getPackageOffset=function(){var I=k.getBoundingClientRect();return new TGOS.TGPoint(I.left,I.top)};this.getCursorPosition=function(I){if(null==I)return null;var Q=this.getPackageOffset();return new TGOS.TGPoint(I.clientX- Q.x,I.clientY-Q.y)};this.ToMapPoint=function(I,Q){return new TGOS.TGPoint(this.ToMapDistX(I-b/2)+e,this.ToMapDistY(Q-f/2)+g)};this.FromMapPoint=function(I,Q){return new TGOS.TGPoint(this.FromMapDistX(I-e)+b/2,this.FromMapDistY(Q-g)+f/2)};this.ToMapDistX=function(I){return I/h.getScaleX()};this.ToMapDistY=function(I){return I/h.getScaleY()};this.FromMapDistX=function(I){return I*h.getScaleX()};this.FromMapDistY=function(I){return I*h.getScaleY()};this.SelectMapTool=function(I){if(I){if(I.InitMapEvent)return t&& t.ExitMapEvent&&t.ExitMapEvent(),I.InitMapEvent(this),t=I,!0}else t&&t.ExitMapEvent&&(t.ExitMapEvent(),t=null);return!1};this.getLayers=function(){return l};this.AddLayer=function(I){null!=I&&(I.Initialize&&I.Initialize(this),l.push(I))};this.RemoveLayer=function(I){var Q,U=l.length;for(Q=0;Qthis.FromMapDistX(Y.getLeft()))&&(I=Y.getLeft());Y.getTop&&(null== Q||this.FromMapDistY(Q)>this.FromMapDistY(Y.getTop()))&&(Q=Y.getTop());Y.getRight&&(null==U||this.FromMapDistX(U)e.Left!=this.Right>this.Left||(this.Left=e.Left),!e.Top||null!=this.Top&&this.Tope.Bottom!=this.Top>this.Bottom||(this.Bottom=e.Bottom))};this.Shrink= function(e){e.constructor==TGOS.TGEnvelope&&(!e.Left||null!=this.Left&&this.Leftthis.Left||(this.Left=e.Left),!e.Top||null!=this.Top&&this.Top>e.Top!=this.Bottome.Right!=this.Leftthis.Bottom||(this.Bottom=e.Bottom))};this.toString=function(){return Math.min(this.Left,this.Right)+" "+Math.min(this.Top,this.Bottom)+","+ Math.max(this.Left,this.Right)+" "+Math.max(this.Top,this.Bottom)}};function Overview(d,a,b,f,e,g){function h(C,L){var I,Q,U=!1;this.ExitMapEvent=null;this.IsMapAction=function(){return U};this.InitMapEvent=function(V){var O=V.getHObject(),Y=function(z){var D=z.screenX-I,w=z.screenY-Q;I=z.screenX;Q=z.screenY;V.MoveMapTo(V.getCenterX()-V.ToMapDistX(D),V.getCenterY()-V.ToMapDistY(w));V.RefreshMap(!1)},M=function(z){DetachEvent(O,"mousemove",Y,!0);DetachEvent(O,"mouseup",M,!1);V.RefreshMap(!0);U=!1},q=function(z){util.disableDefault(z);U=!0;I=z.screenX;Q=z.screenY;AttachEvent(O, "mouseup",M,!1);AttachEvent(O,"mousemove",Y,!0)},m=function(z){C&&(U=!0,z=V.getCursorPosition(z),z=V.ToMapPoint(z.X,z.Y),V.MoveToAnimation(z,V.getScale(),function(){U=!1}))},F=function(z){if(L){U=!0;var D=V.getCursorPosition(z);D=V.ToMapPoint(D.X,D.Y);var w=V.getScale(),u=z.wheelDelta?z.wheelDelta:-z.detail;z=0;0u&&(z=-1);u=1;u=V.getTransformation();u=null!=u&&null!=u.getLevelScale&&null!=u.getMapLevel?u.getLevelScale(u.getMapLevel()+z)/w:Math.pow(2,z);w*=u;D=new MapPoint((V.getCenterX()- D.X)/u+D.X,(V.getCenterY()-D.Y)/u+D.Y);V.MoveToAnimation(D,w,function(){U=!1})}};this.ExitMapEvent=function(){L&&DetachEvent(O.ownerDocument,"mousewheel",F,!1);DetachEvent(O,"mousedown",q,!1);C&&DetachEvent(O,"dblclick",m,!1)};AttachEvent(O,"mousedown",q,!1);C&&AttachEvent(O,"dblclick",m,!1);L&&AttachEvent(O.ownerDocument,"mousewheel",F,!1)}}function l(C){switch(C){case "Open":d.style.width=f+"px";d.style.height=e+"px";d.style.border="2px solid";n.style.width=f+"px";n.style.height=e+"px";G.alt="Open"; G.src=TGOS.RES_PATH+"ShowClose.gif";G.status=!0;break;case "Close":d.style.width="11px",d.style.height="11px",d.style.border="0px",n.style.width="11px",n.style.height="11px",G.alt="Open",G.src=TGOS.RES_PATH+"ShowOpen.gif",G.status=!1}}var n=null,t=null,k=null,p=null,E=null,H=null;this.Show=function(C){C?(d.style.display="inline",l("Open")):d.style.display="none"};this.Minimize=function(){l("Close")};this.FinalRelease=function(){a.RemoveElement(this);p&&p.FinalRelease&&p.FinalRelease();p=null;k&&k.FinalRelease&& k&&k.FinalRelease&&k.FinalRelease();k=null;t&&d.removeChild(t);t=null};this.CenterXY=function(){return new MapPoint(k.getCenterX(),k.getCenterY())};this.SelectAreaHide=function(){m_IndexObj.style.visibility="hidden"};this.SelectAreaShow=function(){m_IndexObj.style.visibility="visible"};this.getTarget=function(){return a};this.getMapDiv=function(){return t};this.getMapBase=function(){return k};this.UpdateElement=function(){p.UpdateElement()};this.RebuildElement=function(){null!=p&&p.RebuildElement(); if(null!=k){var C=a.getScale()/Math.pow(2,g);k.MoveToAnimation(new MapPoint(a.getCenterX(),a.getCenterY()),C)}};var B=new ScaleTransformation(1);B.putBaseScaleX(b.getBaseScaleX());B.putBaseScaleY(b.getBaseScaleY());n=document.createElement("div");d.appendChild(n);n.style.position="absolute";n.style.right="0px";n.style.bottom="0px";this.setColor=function(C){n.style.backgroundColor=C};this.getZoom=function(){var C=this.getTarget().getTransformation(),L=C.getMapLevel()-g;L>C.getMapMaxLevel()&&(L=C.getMapMaxLevel()); LMath.abs(V)||10>Math.abs(O)?(d.style.width=L+"px",d.style.height=I+"px",n.style.width=L+"px",n.style.height=I+"px",d.style.border="0px",J=null,G.status&&(d.style.border="2px solid",d.style.width=L+"px",d.style.height=I+"px",n.style.width= L+"px",n.style.height=I+"px")):(d.style.width=Q+V/2+"px",d.style.height=U+O/2+"px",n.style.width=Q+V/2+"px",n.style.height=U+O/2+"px",J=setTimeout(function(){C(L,I)},50))};null!=J&&clearTimeout(J);J=null;(G.status=!G.status)?(G.alt="Close",G.src=TGOS.RES_PATH+"ShowClose.gif",C(f,e)):(G.alt="Open",G.src=TGOS.RES_PATH+"ShowOpen.gif",d.style.border="2px solid",C(parseInt(G.offsetWidth),parseInt(G.offsetHeight)))};k=new MapBase(t,B,"0px","0px","100%","100%");k.MoveMapTo(a.getCenterX(),a.getCenterY()); k.RefreshMap(!0);p=new function(C){var L=C.getTarget(),I=C.getMapBase(),Q=!1,U=new h(!1,!1),V=I.getHPackage(),O=document.createElement("div");V.appendChild(O);O.style.position="absolute";O.style.overflow="hidden";O.style.width="40px";O.style.height="40px";O.style.left="15px";O.style.top="15px";O.style.border="inset 1px #0300FA";C=O.ownerDocument.createElement("div");O.appendChild(C);C.style.filter="Alpha(Opacity=35)";C.style.opacity=.35;C.style.MozOpacity=.35;C.style.MozUserSelect="none";C.style.backgroundColor= "#5e38ff";C.style.width="100%";C.style.height="100%";var Y,M,q=function(z){var D=z.screenX-Y,w=z.screenY-M;Y=z.screenX;M=z.screenY;L.MoveMapTo(L.getCenterX()+I.ToMapDistX(D),L.getCenterY()+I.ToMapDistY(w));L.RefreshMap(!1)},m=function(z){O.style.cursor="default";DetachEvent(O,"mousemove",q,!0);DetachEvent(O,"mouseup",m,!1);L.RefreshMap(!0)},F=function(z){util.disableDefault(z);Y=z.screenX;M=z.screenY;O.style.cursor="move";AttachEvent(O,"mousemove",q,!0);AttachEvent(O,"mouseup",m,!1)};AttachEvent(O, "mousedown",F,!1);I.SelectMapTool(U);I.AddElement(this);this.FinalRelease=function(){I.RemoveElement(this);DetachEvent(O,"mousedown",F,!1);U&&U.FinalRelease&&U.FinalRelease();U=null;O&&V.removeChild(O);O=null};this.UpdateElement=function(){if(U.IsMapAction())Q||(Q=!0,E.x=parseInt(O.style.left)+parseInt(O.style.width)/2,E.y=parseInt(O.style.top)+parseInt(O.style.height)/2,z=I.ToMapPoint(E.x,E.y),L.MoveMapTo(z.x,z.y),L.RefreshMap(!1),Q=!1);else{var z=L.ToMapPoint(0,0),D=L.ToMapPoint(L.getClientWidth(), L.getClientHeight());E=I.FromMapPoint(z.x,z.y);H=I.FromMapPoint(D.x,D.y);E.x&&E.y&&H.x&&H.y&&(O.style.left=E.x+"px",O.style.top=E.y+"px",O.style.width=H.x-E.x+"px",O.style.height=H.y-E.y+"px")}};this.RebuildElement=function(){U.IsMapAction()&&!Q&&(Q=!0,L.RefreshMap(!0),Q=!1)}}(this);a.AddElement(this);this.RebuildElement()};TGOS.CTRL_ZINDEX=214748364; TGOS.HtmlControl=function(d,a,b,f,e){this.getDiv=function(){return l};this.getPosition=function(){return g};this.setPosition=function(n){var t=d.controls[g].indexOf(l);a in TGOS.TGControlPosition&&(0<=t&&d.controls[g].removeAt(t),d.controls[n].push(l),g=n)};this.setContent=function(n){"string"==typeof n&&(h.innerHTML=n)};this.remove=function(){d.getMapBase().RemoveElement(this);var n=d.controls[g];n.removeAt(n.indexOf(l))};var g=null,h=null,l=null;g=TGOS.TGControlPosition.BOTTOM_LEFT;a in TGOS.TGControlPosition&& (g=a);l=document.createElement("div");util.disableSelect(l);l.style.width="250px";l.style.height="50px";h=document.createElement("div");l.appendChild(h);h.innerHTML=b;h.style.position="absolute";h.style.fontFamily="calibri,\u5fae\u8edf\u6b63\u9ed1\u9ad4";h.style.fontWeight="600";h.style.left="5px";l.style.position="absolute";this.setPosition(g)}; TGOS.CopyrightControl=function(d,a){this.getDiv=function(){return e};this.getPosition=function(){return b};this.setPosition=function(h){var l=d.controls[b].indexOf(e);a in TGOS.TGControlPosition&&(0<=l&&d.controls[b].removeAt(l),d.controls[h].push(e),b=h)};var b=null,f=null,e=null,g=(new Date).getFullYear();b=TGOS.TGControlPosition.BOTTOM_LEFT;a in TGOS.TGControlPosition&&(b=a);e=document.createElement("div");util.disableSelect(e);e.style.width="250px";e.style.height="20px";f=document.createElement("div"); e.appendChild(f);f.innerHTML="TGOS \u00a9 "+g+" \u5167\u653f\u90e8";f.style.position="absolute";f.style.fontFamily="calibri,\u5fae\u8edf\u6b63\u9ed1\u9ad4";f.style.fontWeight="900";f.style.left="5px";e.style.position="absolute";this.setPosition(b)}; TGOS.MapTypeBarControl=function(d,a,b,f){function e(I){E=document.createElement("div");E.style.position="absolute";E.style.overflow="hidden";H=document.createElement("table");H.style.borderSpacing="0";H.border="0";E.appendChild(H);for(var Q=H.insertRow(-1),U=0;UI?1: 5>I?2:5)*U;Q=a.FromMapDistX(I*Q)+2;var V=L/.3048;U=V;var O=1;L="\u82f1\u544e";21702U?1:5>U?2:5)*V;O=a.FromMapDistX(U*O*.3048)+2;J.Inverse(G,new CPoint3(a.getCenterX(),a.getCenterY(),0));n.style.width=Math.round(Math.max(Q,O))+"px";k.style.left=Math.round(Q-4)+"px";p.style.left=Math.round(O-4)+"px";H.innerHTML=I+C;E.innerHTML=U+L}};this.display=function(C){l.style.display=0==C?"none":""};this.ControlOptionsChang= function(C,L){Location(L.getClientWidth(),L.getClientHeight())};this.setPosition(t);this.setStyle(B);this.UpdateElement()};function initControlArray(d){var a=d.controls,b=function(){f.BOTTOM_CENTER_update.call(a.BOTTOM_CENTER);f.BOTTOM_LEFT_update.call(a.BOTTOM_LEFT);f.BOTTOM_RIGHT_update.call(a.BOTTOM_RIGHT);f.LEFT_BOTTOM_update.call(a.LEFT_BOTTOM);f.LEFT_CENTER_update.call(a.LEFT_CENTER);f.LEFT_TOP_update.call(a.LEFT_TOP);f.RIGHT_BOTTOM_update.call(a.RIGHT_BOTTOM);f.RIGHT_CENTER_update.call(a.RIGHT_CENTER);f.RIGHT_TOP_update.call(a.RIGHT_TOP);f.TOP_CENTER_update.call(a.TOP_CENTER);f.TOP_LEFT_update.call(a.TOP_LEFT); f.TOP_RIGHT_update.call(a.TOP_RIGHT)},f={BOTTOM_CENTER_update:function(){var g=0,h=0;a.BOTTOM_CENTER.forEach(function(l,n){n=parseInt(l.clientWidth,10);var t=parseInt(l.clientHeight,10),k=0<=d.getMapSize().width/2-n/2?d.getMapSize().width/2-n/2:0;g+=n;h=Math.max(h,t);l.style.right="auto";l.style.left=k+"px";l.style.top="auto";l.style.bottom="0px"});a.BOTTOM_CENTER.totalWidth=g;a.BOTTOM_CENTER.totalHeight=h},BOTTOM_LEFT_update:function(){var g=0,h=0;a.BOTTOM_LEFT.forEach(function(l,n){n=parseInt(l.scrollWidth, 10);var t=parseInt(l.scrollHeight,10);g+=n;h=Math.max(h,t);l.style.right="auto";l.style.left=g-n+"px";l.style.top="auto";l.style.bottom="0px"});a.BOTTOM_LEFT.totalWidth=g;a.BOTTOM_LEFT.totalHeight=h},BOTTOM_RIGHT_update:function(){var g=0,h=0;a.BOTTOM_RIGHT.forEach(function(l,n){n=parseInt(l.clientWidth,10);var t=parseInt(l.clientHeight,10);g+=n;h=Math.max(h,t);l.style.left="auto";l.style.right=g-n+"px";l.style.top="auto";l.style.bottom="0px"});a.BOTTOM_RIGHT.totalWidth=g;a.BOTTOM_RIGHT.totalHeight= h},TOP_LEFT_update:function(){var g=0,h=0;a.TOP_LEFT.forEach(function(l,n){n=parseInt(l.clientWidth,10);var t=parseInt(l.clientHeight,10);g+=n;h=Math.max(h,t);l.style.right="auto";l.style.left=g-n+"px";l.style.bottom="auto";l.style.top="0px"});a.TOP_LEFT.totalWidth=g;a.TOP_LEFT.totalHeight=h},TOP_CENTER_update:function(){var g=0,h=0;a.TOP_CENTER.forEach(function(l,n){n=parseInt(l.clientWidth,10);var t=parseInt(l.clientHeight,10),k=0<=d.getMapSize().width/2-n/2?d.getMapSize().width/2-n/2:0;g+=n;h= Math.max(h,t);l.style.right="auto";l.style.left=k+"px";l.style.bottom="auto";l.style.top="0px"});a.TOP_CENTER.totalWidth=g;a.TOP_CENTER.totalHeight=h},TOP_RIGHT_update:function(){var g=0,h=0;a.TOP_RIGHT.forEach(function(l,n){n=parseInt(l.clientWidth,10);var t=parseInt(l.clientHeight,10);g+=n;h=Math.max(h,t);l.style.left="auto";l.style.right=g-n+"px";l.style.bottom="auto";l.style.top="0px"});a.TOP_RIGHT.totalWidth=g;a.TOP_RIGHT.totalHeight=h},LEFT_TOP_update:function(){var g=0,h=0,l=0;0=b&&(b=0);return this.insertAt(b,a)};d.pop=function(){var a=this.arr_.length-1;if(!(0>a))return this.removeAt(a)};d.forEach=function(a){for(var b=0;bthis.arr_.length- 1)){var b=this.arr_.splice(a,1);TGOS.TGEvent.trigger_(this,"remove_at",a,b[0]);TGOS.TGEvent.trigger_(this,"changed");return b}};d.insertAt=function(a,b){a>this.arr_.length||(this.arr_.splice(a,0,b),TGOS.TGEvent.trigger_(this,"insert_at",a),TGOS.TGEvent.trigger_(this,"changed"))};d.setAt=function(a,b){if(!(a>this.arr_.length-1)){var f=this.arr_[a];this.arr_.splice(a,1,b);TGOS.TGEvent.trigger_(this,"set_at",a,f);TGOS.TGEvent.trigger_(this,"changed")}};d.indexOf=function(a){return this.arr_.indexOf(a)}; TGOS.RegisterEvent(TGOS.MVCArray,["insert_at","remove_at","set_at","changed"])})();(function(){Array.prototype.find||Object.defineProperty(Array.prototype,"find",{value:function(k){for(var p=0;p>>0;p>>=0;p=0>p?Math.max(B+p,0):Math.min(p,B);E=void 0===E?B:E>>0;for(B=0>E?Math.max(B+ E,0):Math.min(E,B);p=k.length)){var p=k[0].getEventElement();if(p)for(var E=k.length,H=1;HE){k.splice(B,0,p);break}else if(B== k.length-1){k.push(p);break}};this.updateElementOrder=function(p){if(p){var E=p.getEventElement();if(E&&(p=p.getZIndex(),0!==k.length))for(var H=k.length,B=0;Bp){E.insertBefore(J);break}else if(B==k.length-1){E.toFront();break}}}};this.containing=function(p){return 0<=k.indexOf(p)};this.remove=function(p){p=k.indexOf(p);k.splice(p,1)};this.UpdateElement=function(){for(var p=k.length,E=0;Ethis.overlayForwardEvents.indexOf(W[ia])&&this.overlayForwardEvents.push(W[ia]);else W instanceof String&&0>this.overlayForwardEvents.indexOf(W)&&this.overlayForwardEvents.push(W)};this.getOverlayForwardEvents=function(){return this.overlayForwardEvents};this.controls={BOTTOM_CENTER:new TGOS.MVCArray,BOTTOM_LEFT:new TGOS.MVCArray, BOTTOM_RIGHT:new TGOS.MVCArray,LEFT_BOTTOM:new TGOS.MVCArray,LEFT_CENTER:new TGOS.MVCArray,LEFT_TOP:new TGOS.MVCArray,RIGHT_BOTTOM:new TGOS.MVCArray,RIGHT_CENTER:new TGOS.MVCArray,RIGHT_TOP:new TGOS.MVCArray,TOP_CENTER:new TGOS.MVCArray,TOP_LEFT:new TGOS.MVCArray,TOP_RIGHT:new TGOS.MVCArray};this.setKeyboardEdit=function(W,ia){ka.OpenCloseKeyboardEditor(W,ia)};this.getMapSize=function(){var W=parseInt(qa.offsetWidth),ia=parseInt(qa.offsetHeight);return new TGOS.TGSize(W,ia)};this.IndexViewControl= {Show:function(W){na.Show(W);na.getMapBase().RefreshMap(!0)},Minimize:function(){na.Minimize();na.getMapBase().RefreshMap(!0)}};this.setCoordSys=function(W){W instanceof TGOS.TGCoordSys&&(m=W,TGOS.TGEvent.trigger(this,"projection_changed"))};this.getDocName=function(){switch(m){case TGOS.TGCoordSys.EPSG3826:var W=TGOS.MapTypeDocumentName;Ka="97";break;case TGOS.TGCoordSys.EPSG3825:W=TGOS.MapTypeDocumentNameTWD97_119;Ka="97_119";break;case TGOS.TGCoordSys.EPSG3857:W=TGOS.MapTypeDocumentNameGoogle, Ka="google"}return W};this.getCoordSys=function(){return m};this.getOPackage=function(){return za};this.getMapOptions=function(){return R};this.getMapTypeId=function(){return Ia};this.getHPackage=function(){return qa};this.getHPack=function(){return pa.getHPackage()};this.getHObj=function(){return pa.getHObject()};this.getHMap=function(){return pa.getHObject()};this.getMapBase=function(){return pa};this.getMap=function(){return this};this.ZoomTo=function(W){M(W)};this.ZoomIn=function(){M(Sa.getMapLevel()+ 1)};this.ZoomOut=function(){M(Sa.getMapLevel()-1)};this.setOptions=function(W){var ia=function(Fa){switch(m){case TGOS.TGCoordSys.EPSG3857:var gb=TGOS.WGS84ToGoo(Fa.left,Fa.top);Fa=TGOS.WGS84ToGoo(Fa.right,Fa.bottom);gb=new TGOS.TGEnvelope(gb.x,gb.y,Fa.x,Fa.y);break;default:gb=Fa}Sa.setMapBoundsLevel(gb);ka.setMapBounds(gb);pa.RefreshMap(!0)},la=function(Fa,gb){var pb=Fa,rb=gb;null!=pb&&null!=rb&&pb>rb&&(pb=gb,rb=Fa);Sa.setMapMinMaxLevel(pb,rb);pa.RefreshMap(!0)},Ca=function(Fa){"string"==typeof Fa&& (pa.setColor(Fa),R.backgroundColor=Fa)},xa=function(Fa){"boolean"==typeof Fa&&(Fa?(ca.display(!1),Z.display(!1),bb.display(!1)):(ca.display(!0),Z.display(!0),bb.display(!0)),R.disableDefaultUI=Fa,pa.RefreshMap(!0))},Ga=function(Fa){"boolean"==typeof Fa&&(da=Fa,R.scrollwheel=Fa,ka.OpenCloseWheel(Fa))},Ma=function(Fa){"boolean"==typeof Fa&&(Z.display(Fa),R.mapTypeControl=Fa)},Ua=function(Fa){Z.setOptions(Fa);R.mapTypeControlOptions=Fa;pa.RefreshMap(!0)},ab=function(Fa){"boolean"==typeof Fa&&(bb.display(Fa), R.navigationControl=Fa);pa.RefreshMap(!0)},jb=function(Fa){bb.setOptions(Fa);R.navigationControlOptions=Fa},kb=function(Fa){"boolean"==typeof Fa&&(ca.display(Fa),R.scaleControl=Fa)},fb=function(Fa){ca.setOptions(Fa);R.scaleControlOptions=Fa},ob=function(Fa){"boolean"==typeof Fa&&(na.Show(Fa),R.indexViewControl=Fa)},nb=function(Fa){Fa==TGOS.TGIndexViewControlOptions.MINIMIZED&&(na.Minimize(),R.indexViewControlOptions=Fa)},ub=function(Fa){"boolean"==typeof Fa&&(ea=Fa,R.draggable=Fa,ka.OpenCloseMove(Fa))}, Db=function(Fa){"boolean"==typeof Fa&&(ka.allowKeyboard(Fa),R.keyboardShortcuts=Fa)},ta=function(Fa){"boolean"==typeof Fa&&(ka.setDragInertia(Fa),R.dragInertia=Fa)},Na=function(Fa){"string"==typeof Fa&&(ka.changeDraggableCursor(Fa),R.draggableCursor=Fa)},Ya=function(Fa){"string"==typeof Fa&&(ka.changeDraggingCursor(Fa),R.draggingCursor=Fa)};void 0!=W&&(void 0!=W.backgroundColor&&Ca(W.backgroundColor),void 0!=W.disableDefaultUI&&xa(W.disableDefaultUI),void 0!=W.scrollwheel&&Ga(W.scrollwheel),void 0!= W.mapTypeControl&&Ma(W.mapTypeControl),void 0!=W.mapTypeControlOptions&&Ua(W.mapTypeControlOptions),void 0!=W.navigationControl&&ab(W.navigationControl),void 0!=W.navigationControlOptions&&jb(W.navigationControlOptions),void 0!=W.scaleControl&&kb(W.scaleControl),void 0!=W.scaleControlOptions&&fb(W.scaleControlOptions),void 0!=W.indexViewControl&&ob(W.indexViewControl),void 0!=W.indexViewControlOptions&&nb(W.indexViewControlOptions),void 0!=W.draggable&&ub(W.draggable),void 0!=W.keyboardShortcuts&& Db(W.keyboardShortcuts),void 0!=W.draggableCursor&&Na(W.draggableCursor),void 0!=W.dragInertia&&ta(W.dragInertia),void 0!=W.draggingCursor&&Ya(W.draggingCursor),void 0!=W.center&&sa.setCenter(W.center),void 0!=W.dbClickZoomIn&&ka.OpenCloseDblClick(W.dbClickZoomIn),void 0!==W.maxZoom&&void 0!==W.minZoom?la(W.minZoom,W.maxZoom):(void 0!==W.maxZoom&&(Sa.setMapMaxLevel(W.maxZoom),pa.RefreshMap(!0)),void 0!==W.minZoom&&(Sa.setMapMinLevel(W.minZoom),pa.RefreshMap(!0))),void 0!==W.mapBounds&&ia(W.mapBounds))}; this.freezeMap=function(){Xa||(ka.ExitMapEvent(),Xa=!0)};this.unFreezeMap=function(){Xa&&(ka.InitMapEvent(this),Xa=!1)};this.loopThroughOverlay=function(){};this.resize=function(W,ia){qa.style.width=W+"px";qa.style.height=ia+"px";B=qa.clientWidth;G=qa.clientHeight};this.getBoundary=function(){return pa.getExtent()};this.getLevel=function(){return Sa.getMapLevel()};this.getDiv=function(){return Ha};this.getEventElement=function(){return this.getHObj()};this.getTransformation=function(){return Sa}; this.fitBounds=function(W){if(null!=W.left&&null!=W.top&&null!=W.right&&null!=W.bottom){var ia={X:0,Y:0},la={X:0,Y:0};m==TGOS.TGCoordSys.EPSG3857?(ia=a.Forward(d,new CPoint3(W.left,W.top,0)),la=a.Forward(d,new CPoint3(W.right,W.bottom,0))):(ia.X=W.left,ia.Y=W.top,la.X=W.right,la.Y=W.bottom);TGOS.moveMapTo_(this,(la.X+ia.X)/2,(la.Y+ia.Y)/2);pa.putScale(Math.min(Math.abs(Number(qa.clientWidth)/(la.X-ia.X)),Math.abs(Number(qa.clientHeight)/(la.Y-ia.Y))));Sa.FitLevel();pa.RefreshMap(!0)}};this.getRawBound= function(){var W=B,ia=G,la=pa.ToMapPoint(0,0);W=pa.ToMapPoint(W,ia);return new TGOS.TGEnvelope(la.x,la.y,W.x,W.y)};this.getBounds=function(){var W=B,ia=G,la=pa.ToMapPoint(0,0);W=pa.ToMapPoint(W,ia);switch(m){case TGOS.TGCoordSys.EPSG3857:var Ca=TGOS.GooToWGS84(la.x,la.y);la=TGOS.GooToWGS84(W.x,W.y);var xa=Ca.x;Ca=Ca.y;var Ga=la.x;var Ma=la.y;break;case TGOS.TGCoordSys.EPSG3826:xa=la.x;Ca=la.y;Ga=W.x;Ma=W.y;break;case TGOS.TGCoordSys.EPSG3825:xa=la.x,Ca=la.y,Ga=W.x,Ma=W.y}return new TGOS.TGEnvelope(xa, Ca,Ga,Ma)};this.checkMapBoundsRestrict=function(W,ia,la){var Ca=null;if(W){var xa=0,Ga=0,Ma=this.getRawBound(),Ua=Ma.top-Ma.bottom,ab=W.top-W.bottom;Ma.right-Ma.left>W.right-W.left?(xa=1,ia=(W.left+W.right)/2):Ma.leftW.right&&(xa=Ma.right-W.right,ia-=xa);Ua>ab?(Ga=1,la=(W.top+W.bottom)/2):Ma.top>W.top?(Ga=Ma.top-W.top,la-=Ga):Ma.bottomla&&(ia=la);Sa.putMapLevel(ia);Z.setActiveType(W);this.changeOverviewMapType(Pa,W);pa.RefreshMap(!0)}};this.panBy=function(W,ia){ka.panBy(W,ia);pa.RefreshMap(!0)};this.panToBounds=function(W){if(null!=W.left&&null!=W.top&&null!=W.right&&null!=W.bottom){switch(m){case TGOS.TGCoordSys.EPSG3857:W=TGOS.WGS84ToGoo(W.left,W.top);var ia=W.x;var la= W.y;break;case TGOS.TGCoordSys.EPSG3826:ia=W.left;la=W.top;break;case TGOS.TGCoordSys.EPSG3825:ia=W.left,la=W.top}TGOS.moveMapTo_(this,ia,la);pa.RefreshMap(!0)}};this.getLayerList=function(){return La};this.setMapAction=function(W,ia){if(1==W){var la=pa.getHObject(),Ca=function(Ga,Ma,Ua,ab){DetachEvent(la,"mousedown",xa,!1);freezeMap||ka.InitMapEvent(this);null!=ia&&ia(Ga,Ma,Ua,ab)},xa=function(Ga){RectangleTracker(pa,Ga,Ca)};ka.ExitMapEvent();AttachEvent(la,"mousedown",xa,!1)}else freezeMap||ka.InitMapEvent(this)}; this.getCoordinateString=function(W,ia){W=pa.ToMapPoint(W,ia);return W.x+","+W.y};this.changeOverviewMapType=function(W,ia){for(var la=0;la=Pa.length?Pa[W]=ia:Pa.splice(W,0,ia)}na.getMapBase().AddLayer(Pa[W]);Pa[W].putVisible(!1)}},M=function(W){!Xa&&Sa.putMapLevel(W)&&(W=Sa.getScale(),pa.putScale(W),pa.RefreshMap(!0))},q;this.setBackgroundColor=function(W){"string"==typeof W&&(q=!0,pa.setColor(W),R.backgroundColor=W)};this.getBackgroundColor=function(){return R.backgroundColor};this.bcTimer=null;this.refreshMapWithIdle=function(W){clearTimeout(this.bcTimer); pa.RefreshMap(!1);if(W){var ia=this;this.bcTimer=setTimeout(function(){pa.RefreshMap(!0);TGOS.TGEvent.trigger(ia,"idle")},20)}};this.setMapTypeNLSC=function(W){ya=W};this.getMapTypeNLSC=function(){return ya};this.initialize_=function(W){this.infoWindowLayer=new b(Da,this);this.overlay=new f(Ba);if("EPSG3857"==m){Ka="google";var ia=a.Forward(d,new CPoint3(118.9940295414,25.30028310652,0)),la=a.Forward(d,new CPoint3(122.0064955717,21.896606644941,0));Va=new TGOS.TGEnvelope(la.X,la.Y,ia.X,ia.Y);ia=TGOS.MapTypeScales.EPSG3857.levelX; la=TGOS.MapTypeScales.EPSG3857.levelY;var Ca=TGOS.MapTypeScales.EPSG3857.scales}else"EPSG3825"==m?(Ka="97_119",Va=new TGOS.TGEnvelope(339023.59349082,2425702.7292442,51368.8242689183,2799323.57990279),ia=TGOS.MapTypeScales.EPSG3825.levelX,la=TGOS.MapTypeScales.EPSG3825.levelY,Ca=TGOS.MapTypeScales.EPSG3825.scales):(Ka="97",Va=new TGOS.TGEnvelope(339023.59349082,2425702.7292442,51368.8242689183,2799323.57990279),ia=TGOS.MapTypeScales.EPSG3826.levelX,la=TGOS.MapTypeScales.EPSG3826.levelY,Ca=TGOS.MapTypeScales.EPSG3826.scales); for(var xa in TGOS.MapTypeMaxZoomLevel[m])Wa=Math.max(TGOS.MapTypeMaxZoomLevel[m][xa],Wa);xa=[TGOS.TGMapTypeId.TGOSMAP,TGOS.TGMapTypeId.NLSCMAP,TGOS.TGMapTypeId.MOTCMAP,TGOS.TGMapTypeId.F2IMAGE,TGOS.TGMapTypeId.ROADMAP,TGOS.TGMapTypeId.HILLSHADEMIX,TGOS.TGMapTypeId.HILLSHADE,TGOS.TGMapTypeId.SEGISMAP,TGOS.TGMapTypeId.IMAGENLSC,TGOS.TGMapTypeId.TGOSMAP_NP];void 0!==W&&(void 0!==W.mapTypeNLSC&&this.setMapTypeNLSC(W.mapTypeNLSC),void 0!==W.mapTypeControlOptions&&void 0!==W.mapTypeControlOptions.mapTypeIds&& (xa=W.mapTypeControlOptions.mapTypeIds));J(xa,Ka);C(xa,Ka);qa=document.createElement("div");k.appendChild(qa);qa.style.position="relative";qa.style.overflow="hidden";qa.style.width=k.offsetWidth+"px";qa.style.height=k.offsetHeight+"px";qa.style.border="0px";qa.style.left="0px";qa.style.top="0px";qa.unselectable="on";qa.className="hpack";B=qa.clientWidth;G=qa.clientHeight;Sa=new TGOS.MapScaleLevel(Oa,Wa,ia,la,Ca);pa=new MapBase(qa,Sa);this.bindEvents(this.getEventElement());k.style.overflow="hidden"; pa.AddElement(this.overlay);pa.AddElement(this.infoWindowLayer);pa.setColor("#a5bfdd");pa.ZoomMapTo(Va);Sa.FitLevel();initControlArray(this);for(ia=0;ia=K.length?la.insertBefore(ia,Ca):la.insertBefore(ia,K[0].div.main);var Ga=Raphael(ia);Ga.canvas.setAttribute("fill-rule","evenodd");Ga.canvas.setAttribute("pointer-events","auto");Ga.rect(0,0,300,300).hide();var Ma=document.createElement("div");Ma.style.position="absolute";Ma.style.width="100%";Ma.style.height="100%";Ma.style.pointerEvents="auto";Ma.className="IndependentContainer";W&&(Ma.className=Ma.className+"_"+W);la.insertBefore(Ma,Ca);W=Raphael(Ma);W.canvas.setAttribute("fill-rule", "evenodd");W.canvas.setAttribute("pointer-events","auto");W.rect(0,0,300,300).hide();xa={layerId:xa,div:{main:Ma,shadow:ia},paper:{main:W,shadow:Ga}};K.push(xa);return xa};this.removeAdvancedLayer=function(W){A&&(W=A.indexOf(W),0<=W&&A.splice(W,1))};this.removeIndependentContainer=function(W){var ia=this.getMapBase().getHObject();if(K){var la=K.indexOf(W);0<=la&&(ia.removeChild(W.div.main),ia.removeChild(W.div.shadow),K.splice(la,1))}};this.getAdvancedLayers=function(){return A};this.getIndependentContainers= function(){return K};this.moveIndependentContainerToTop=function(W){var ia=this.getMapBase().getHObject();if(null!=ia&&K&&null!=W){var la=K.indexOf(W);if(0<=la&&01E3*Ha?(TGOS.moveMapTo_(L,Oa.x,Oa.y),L.refreshMapWithIdle(!0),clearInterval(ca)):(na=(na-Z)/(1E3*Ha),Wa.putCenterX(Sa+na*db),Wa.putCenterY(Xa+na*bb),L.refreshMapWithIdle(!1))},Va)};this.panBy=function(Oa,Ha){var Va=L.getMapBase(),Wa=Va.getClientWidth(),Sa=Va.getClientHeight();Oa=Va.getCenterX()+Oa; Ha=Va.getCenterY()+Ha;Va=Va.FromMapPoint(Oa,Ha);0<=Va.x&&Va.x<=Wa&&0<=Va.y&&Va.y<=Sa?La({x:Oa,y:Ha},.5,30):TGOS.moveMapTo_(L,Oa,Ha)};this.panToBounds=function(Oa){var Ha=L.getMapBase();Oa=Ha.getClientWidth();var Va=Ha.getClientHeight(),Wa=Ha.getCenterX()+offsetX,Sa=Ha.getCenterY()+offsetY;Ha=Ha.FromMapPoint(Wa,Sa);0<=Ha.x&&Ha.x<=Oa&&0<=Ha.y&&Ha.y<=Va?La({x:Wa,y:Sa},.5,30):TGOS.moveMapTo_(L,Wa,Sa)};this.setMapBounds=function(Oa){I=Oa;var Ha=L.getMapBase();Oa=Ha.getCenterX();Ha=Ha.getCenterY();Oa=L.checkMapBoundsRestrict(I, Oa,Ha);null!=Oa&&(TGOS.moveMapTo_(L,Oa.x,Oa.y),L.refreshMapWithIdle(!0))};this.allowKeyboard=function(Oa){"boolean"==typeof Oa&&(aa=Oa)};this.clearNum=function(){c=0};var Pa=!0;this.setDragInertia=function(Oa){"boolean"==typeof Oa&&(Pa=Oa)};this.changeDraggableCursor=function(Oa){S=Oa;fa.style.cursor=S};this.changeDraggingCursor=function(Oa){R=Oa};this.InitMapEvent=function(Oa){var Ha=Oa.getMapBase();fa=Ha.getHObject();Ha.getHPackage();var Va=[],Wa=function(ta){setTimeout(function(){O=0},ta)},Sa= function(ta,Na,Ya){var Fa=20;Ya&&(Fa=Ya);return Math.abs(ta.X-Na.X)<=Fa&&Math.abs(ta.Y-Na.Y)<=Fa?!0:!1},Xa=function(ta,Na){ta=Ha.getCursorPosition(ta);Na=Ha.getCursorPosition(Na);var Ya=parseFloat((ta.x+Na.x)/2),Fa=parseFloat((ta.y+Na.y)/2);return{scrCenter:{X:Ya,Y:Fa},length:Math.sqrt((ta.x-Na.x)*(ta.x-Na.x)+(ta.y-Na.y)*(ta.y-Na.y))}},db=function(ta){Va=ta.touches;W&&W.stop();qa=sa=0;ta=Va[0];var Na={X:ta.clientX,Y:ta.clientY,MX:Ha.getCenterX(),MY:Ha.getCenterY()};0==O?O=1:2==O&&1==Sa(Na,Q)?(O=3, V=ta):O=0;Q=Na;if(1la&&2pa&&TGOS.TGEvent.trigger(L,"dragstart");TGOS.TGEvent.trigger(L,"drag");pa++}},W,ia=500,la=.08,Ca=function(ta){util.disableDefault(ta);if(E){DetachEvent(fa,"mousemove",ya,!0);DetachEvent(fa,"mouseup",Ca,!0);fa.style.cursor=S?S:"default";K=!1;if(Pa&&Math.hypot(sa,qa)>la&&2ta&&(Fa=-1);k.putMapLevel(k.getMapLevel()+Fa);ta=Ha.getScale()/Ya;Na=new TGOS.TGPoint((Ha.getCenterX()- Na.x)/ta+Na.x,(Ha.getCenterY()-Na.y)/ta+Na.y);I&&(ta=L.checkMapBoundsRestrict(I,Na.x,Na.y),null!=ta&&(Na.x=ta.x,Na.y=ta.y));TGOS.moveMapTo_(L,Na.x,Na.y);L.refreshMapWithIdle(!0)}},ob=0,nb=function(ta){aa&&(ob=0)},ub=function(ta){function Na(pb,rb){TGOS.moveMapTo_(L,Ha.getCenterX()+pb,Ha.getCenterY()+rb);L.refreshMapWithIdle(!1)}if(aa&&!ea){var Ya=Ha.getTransformation();ob+=4;24L&&(M=L),this.setMapMinLevel(M)};this.getBaseScaleX=function(){return Q};this.putBaseScaleX=function(M){Q= M};this.getBaseScaleY=function(){return U};this.putBaseScaleY=function(M){U=M};this.getMapMinLevel=function(){return I};this.setMapMinMaxLevel=function(M,q){L=null==q?TGOS.MapTypeMaxZoomLevel[k.getCoordSys()][k.getMapTypeId()]:Math.min(q,TGOS.MapTypeMaxZoomLevel[k.getCoordSys()][k.getMapTypeId()]);I=null==M?0:M;C>L?(this.putMapLevel(L),k.setZoom(L)):CL&&(this.putMapLevel(L),k.setZoom(L))};this.getMapMaxLevel=function(){Math.min(L,TGOS.MapTypeMaxZoomLevel[k.getCoordSys()][k.getMapTypeId()]);return L};this.setMapMinLevel=function(M){I=null==M?0:M;CL?L:z;var D=null==I?0:I,w=M>z?z:Mz||MM.sclientx-z.clientX||-2>M.sclienty-z.clientY)M.dragMoved=!0;d(z);DetachEvent(document.body,"mousemove",M.markMove,!0);DetachEvent(document.body,"mouseup",M.endDrag,!0);!M.dragMoved&&M.editable? null!=M.clickCallback&&M.clickCallback.call(this,M):null!=M.movedCallback&&M.movedCallback.call(this,M)};this.markMove=function(z){d(z);var D=n.getMapBase(),w=D.getPackageOffset();switch(n.getCoordSys()){case TGOS.TGCoordSys.EPSG3857:var u=D.ToMapPoint(z.clientX-w.x,z.clientY-w.y);u=TGOS.GooToWGS84(u.x,u.y);u=new TGOS.TGPoint(u.x,u.y);break;case TGOS.TGCoordSys.EPSG3826:u=D.ToMapPoint(z.clientX-w.x,z.clientY-w.y);break;case TGOS.TGCoordSys.EPSG3825:u=D.ToMapPoint(z.clientX-w.x,z.clientY-w.y)}z=u.x- M.spos.x;u=u.y-M.spos.y;D=t.getBounds();t.transform(1,0,0,1,z-(D.left-M.senv.left),u-(D.top-M.senv.top));M.update();M.editable&&null!=M.moveCallback&&M.moveCallback.call(this,M)};this.markDrag=function(z){d(z);M.sclientx=z.clientX;M.sclienty=z.clientY;M.dragMoved=!1;var D=n.getMapBase(),w=D.getPackageOffset();switch(n.getCoordSys()){case TGOS.TGCoordSys.EPSG3857:z=D.ToMapPoint(z.clientX-w.x,z.clientY-w.y);z=TGOS.GooToWGS84(z.x,z.y);var u=new TGOS.TGPoint(z.x,z.y);break;case TGOS.TGCoordSys.EPSG3826:u= D.ToMapPoint(z.clientX-w.x,z.clientY-w.y);break;case TGOS.TGCoordSys.EPSG3825:u=D.ToMapPoint(z.clientX-w.x,z.clientY-w.y)}M.spos=u;z=t.getBounds();M.senv=new TGOS.TGEnvelope(z.left,z.top,z.right,z.bottom);AttachEvent(document.body,"mousemove",M.markMove,!0);AttachEvent(document.body,"mouseup",M.endDrag,!0)};this.clone=function(){var z={opacity:this.getOpacity(),fillColor:this.getFillColor(),fillOpacity:this.getFillOpacity(),fillOutline:this.getFillOutline(),strokeColor:this.getStrokeColor(),strokeWeight:this.getStrokeWeight(), strokeOpacity:this.getStrokeOpacity(),strokeLinejoin:this.getStrokeLinejoin(),strokeLinecap:this.getStrokeLinecap(),strokeDasharray:this.getStrokeDasharray()};z=new TGOS.TGFill(null,this.getPath(),z);z.setTitle(this.getTitle());return z};this.setClickCallback=function(z){this.clickCallback=z};this.setMoveCallback=function(z){this.moveCallback=z};this.setMovedCallback=function(z){this.movedCallback=z};this.getEditable=function(){return this.editable};this.setEditable=function(z){this.editable=z;this.setDraggable(z)}; this.getDraggable=function(){return this.draggable};this.setDraggable=function(z){void 0!==z&&(this.draggable=z,this.elem&&(1==z&&this.elem?this.elem.mousedown(this.markDrag):0==z&&this.elem&&this.elem.unmousedown(this.markDrag)))};this.getVisible=function(){return O};this.setVisible=function(z){switch(z){case !0:O=!0;m.show();this.redraw();this.update();break;case !1:m.hide(),O=!1,this.redraw(),this.update()}};this.getAdvancedLayer=function(){return F};this.setAdvancedLayer=function(z){F=z};this.getPaper= function(){return null!=F?F.paper.main:n.getPaper()};this.getMap=function(){return n};this.setMap=function(z){m&&m.remove();if(null==z){if(!n)return;n.overlay.containing(this)&&n.overlay.remove(this);TGOS.TGEvent.clearInstanceListeners(this);n=null}z instanceof TGOS.TGOnlineMap&&(n=z,this.init())};this.getPath=function(){return t};this.setPath=function(z){t=z;this.redraw(!0)};this.isPointInEnvelope=function(z,D){var w=null,u=t;void 0!==u&&null!=u&&(u.getEnvelope&&(u=u.getEnvelope()),u.left&&(w=z>= u.left&&z<=u.right&&D>=u.bottom&&D<=u.top?!0:!1));return w};this.getEnvelope=function(){if(this.getPath){var z=this.getPath();if(void 0!==z)return void 0!==z.Envelope?z.Envelope:z}return null};this.getBounds=function(){if(t){if(t instanceof TGOS.TGCircle){var z=n.getCoordSys();z=t.getBounds(z)}else z=t.getBounds();return z}};this.setClickable=function(z){"boolean"===typeof z&&((k=z)?TGOS.TGEvent.releaseEventLock(this,"click"):TGOS.TGEvent.lockEvent(this,"click"),TGOS.TGEvent.trigger(this,"clickable_changed"))}; this.getOpacity=function(){return p};this.setOpacity=function(z){p=z;m&&m.attr({opacity:p})};this.getFillOpacity=function(){return E};this.setFillOpacity=function(z){E=z;m&&m.attr({"fill-opacity":p})};this.getFillOutline=function(){return B};this.setFillOpacity=function(z){B=z;m&&m.attr({"stroke-opacity":p})};this.getTitle=function(){return V};this.setTitle=function(z){V=z;m&&(m.attr({title:V}),TGOS.TGEvent.trigger(this,"title_changed"))};this.getClickable=function(){return k};this.getFillColor=function(){return H}; this.setFillColor=function(z){H=z;m&&m.attr({fill:H})};this.getStrokeColor=function(){return G};this.setStrokeColor=function(z){G=z;m&&m.attr({stroke:z})};this.getStrokeWeight=function(){return J};this.setStrokeWeight=function(z){J=z;m&&m.attr({"stroke-width":J})};this.getStrokeOpacity=function(){return I};this.setStrokeOpacity=function(z){I=z;m&&m.attr({"stroke-opacity":I})};this.getStrokeLinecap=function(){return C};this.setStrokeLinecap=function(z){C=z;m&&m.attr({"stroke-linecap":C})};this.getStrokeLinejoin= function(){return L};this.setStrokeLinejoin=function(z){L=z;m&&m.attr({"stroke-linejoin":L})};this.getStrokeDasharray=function(){return Q};this.setStrokeDasharray=function(z){Q=z;m&&m.attr({"stroke-dasharray":Q})};this.getZIndex=function(){return U};this.setZIndex=function(z,D){"number"===typeof z&&m&&(U=parseFloat(z),n.overlay.updateArrayOrder(this),n.overlay.updateElementOrder(this),TGOS.TGEvent.trigger(this,"zindex_changed"))};this.update=function(){if(t&&n)if(O){var z=n.getMapBase(),D=this.getAnchorPoint(); z=z.FromMapPoint(D.x,D.y);m.transform("t"+(z.x-h)+","+(z.y-l))}else m.hide()};this.createPathStr=function(){var z="",D=n.getCoordSys(),w=n.getMapBase(),u=w.getCellSizeX();D==TGOS.TGCoordSys.EPSG3857&&(u/=111E4);if(t instanceof TGOS.TGPolygon){z+=b(w,D,u,t.getExteriorRing());for(var A=t.getInteriorRings(),K=0;KO.sclientx-m.clientX||-2>O.sclienty-m.clientY)O.dragMoved=!0;d(m);DetachEvent(document.body,"mousemove",O.markMove,!0);DetachEvent(document.body, "mouseup",O.endDrag,!0);!O.dragMoved&&O.editable?null!=O.clickCallback&&O.clickCallback.call(this,O):null!=O.movedCallback&&O.movedCallback.call(this,O)};this.markMove=function(m){d(m);var F=h.getMapBase(),z=F.getPackageOffset();switch(h.getCoordSys()){case TGOS.TGCoordSys.EPSG3857:var D=F.ToMapPoint(m.clientX-z.x,m.clientY-z.y);D=TGOS.GooToWGS84(D.x,D.y);D=new TGOS.TGPoint(D.x,D.y);break;case TGOS.TGCoordSys.EPSG3826:D=F.ToMapPoint(m.clientX-z.x,m.clientY-z.y);break;case TGOS.TGCoordSys.EPSG3825:D= F.ToMapPoint(m.clientX-z.x,m.clientY-z.y)}m=n.Envelope;n.transform(1,0,0,1,D.x-O.spos.x-(m.left-O.senv.left),D.y-O.spos.y-(m.top-O.senv.top));O.update();O.editable&&null!=O.moveCallback&&O.moveCallback.call(this,O)};this.markDrag=function(m){O.sclientx=m.clientX;O.sclienty=m.clientY;O.dragMoved=!1;O.selected=!1;d(m);var F=h.getMapBase(),z=F.getPackageOffset();switch(h.getCoordSys()){case TGOS.TGCoordSys.EPSG3857:m=F.ToMapPoint(m.clientX-z.x,m.clientY-z.y);m=TGOS.GooToWGS84(m.x,m.y);var D=new TGOS.TGPoint(m.x, m.y);break;case TGOS.TGCoordSys.EPSG3826:D=F.ToMapPoint(m.clientX-z.x,m.clientY-z.y);break;case TGOS.TGCoordSys.EPSG3825:D=F.ToMapPoint(m.clientX-z.x,m.clientY-z.y)}O.spos=D;m=n.Envelope;O.senv=new TGOS.TGEnvelope(m.left,m.top,m.right,m.bottom);AttachEvent(document.body,"mousemove",O.markMove,!0);AttachEvent(document.body,"mouseup",O.endDrag,!0)};this.clone=function(){var m={opacity:this.getOpacity(),strokeWeight:this.getStrokeWeight(),strokeOpacity:this.getStrokeOpacity(),strokeLinecap:this.getStrokeLinecap(), strokeLinejoin:this.getStrokeLinejoin(),strokeColor:this.getStrokeColor(),strokeDasharray:this.getStrokeDasharray(),icons:this.getIcons()};m=new TGOS.TGLine(null,this.getPath(),m);m.setTitle(this.getTitle());return m};this.setClickCallback=function(m){this.clickCallback=m};this.setMoveCallback=function(m){this.moveCallback=m};this.setMovedCallback=function(m){this.movedCallback=m};this.getEditable=function(){return this.editable};this.setEditable=function(m){this.editable=m;this.setDraggable(m)}; this.getDraggable=function(){return this.draggable};this.setDraggable=function(m){this.draggable=m;Y&&(m&&Y?Y.mousedown(this.markDrag):Y.unmousedown(this.markDrag))};this.isPointInEnvelope=function(m,F){var z=null,D=n;void 0!==D&&null!=D&&(D.getEnvelope&&(D=D.getEnvelope()),D.left&&(z=m>=D.left&&m<=D.right&&F>=D.bottom&&F<=D.top?!0:!1));return z};this.getEventElement=function(){return Y};this.calEnv=function(){for(var m=n.getPath(),F=Infinity,z=-Infinity,D=-Infinity,w=Infinity,u=0;uG&&0<=G&&(l=G,p&&p.attr({opacity:G}),this.redraw(),this.update())};this.getImage=function(){return null!=this.url?this.url:n};this.setImage=function(G){if(G instanceof TGOS.TGImage)n=G,p&&(p.attr({src:n.getUrl()}),this.redraw(),this.update());else if("string"==typeof G&&(this.url=G,-1=l.length)throw"Invalid WKT : "+d;d=l[1].toUpperCase();var n=l[2];if(a(d,"POINT"))return a=n.split(f),{type:"POINT",geometry:new TGOS.TGPoint(parseFloat(a[0]),parseFloat(a[1]))};if(a(d,"LINESTRING")){l=[];d=n.split(e);for(h=0;hh||a.x==b.x&&a.y==b.y?(f=-1,e=a.x,a=a.y):1d.right==this.right>this.left)||d.top&&(null==this.top||this.topd.top==this.top>this.bottom)?!1:!0}; TGOS.TGEnvelope.prototype.Extend=function(d){d.constructor==TGOS.TGEnvelope&&(!d.left||null!=this.left&&this.left>d.left!=this.right>this.left||(this.left=d.left),!d.top||null!=this.top&&this.topd.bottom!=this.top>this.bottom||(this.bottom=pEnv.bottom))}; TGOS.TGEnvelope.prototype.Shrink=function(d){d.constructor==TGOS.TGEnvelope&&(!d.left||null!=this.left&&this.leftthis.left||(this.left=d.left),!d.top||null!=this.top&&this.top>d.top!=this.bottomd.right!=this.leftthis.bottom||(this.bottom=d.bottom))}; TGOS.TGEnvelope.prototype.toString=function(){return Math.min(this.left,this.right)+" "+Math.min(this.top,this.bottom)+","+Math.max(this.left,this.right)+" "+Math.max(this.top,this.bottom)}; TGOS.TGEnvelope.prototype.nearestPoint=function(d,a,b){var f=null,e=null,g=Infinity;void 0!==a&&(g=a);if(d instanceof TGOS.TGPoint){a=new TGOS.TGPoint(this.left,this.top);var h=new TGOS.TGPoint(this.right,this.top),l=new TGOS.TGPoint(this.right,this.bottom),n=new TGOS.TGPoint(this.left,this.bottom),t=new TGOS.TGPoint(this.left,this.top);a=new TGOS.TGLineString([a,h,l,n,t]);a.nearestPoint&&(d=a.nearestPoint(d,g,b),null!=d&&(null!=d.point&&(f=d.point),null!=d.distance&&(e=d.distance)))}return null!= f?{point:f,distance:e}:null};TGOS.TGEnvelope.prototype.transform=function(d,a,b,f,e,g){var h=new TGOS.TGPoint(this.left,this.top),l=new TGOS.TGPoint(this.right,this.bottom);h.transform(d,a,b,f,e,g);l.transform(d,a,b,f,e,g);this.left=h.x;this.top=h.y;this.right=l.x;this.bottom=l.y;this.renderer&&this.renderer.redraw()};TGOS.TGEnvelope.prototype.isEmpty=function(){var d=IsNumeric(this.left),a=IsNumeric(this.top),b=IsNumeric(this.right),f=IsNumeric(this.bottom);return 1==d&&1==a&&1==b&&1==f?!0:!1}; TGOS.TGEnvelope.prototype.setEmpty=function(){this.bottom=this.right=this.top=this.left=null};TGOS.TGEnvelope.prototype.getLeft=function(){return this.left};TGOS.TGEnvelope.prototype.getTop=function(){return this.top};TGOS.TGEnvelope.prototype.getRight=function(){return this.right};TGOS.TGEnvelope.prototype.getBottom=function(){return this.bottom};TGOS.TGEnvelope.prototype.setLeft=function(d){this.left=d};TGOS.TGEnvelope.prototype.setTop=function(d){this.top=d}; TGOS.TGEnvelope.prototype.setRight=function(d){this.right=d};TGOS.TGEnvelope.prototype.setBottom=function(d){this.bottom=d};TGOS.TGEnvelope.prototype.getWidth=function(){return Math.abs(this.left-this.right)};TGOS.TGEnvelope.prototype.getHeight=function(){return Math.abs(this.top-this.bottom)};TGOS.TGEnvelope.prototype.getEnvelope=function(){return this};TGOS.TGEnvelope.prototype.getBounds=function(){return this}; TGOS.TGEnvelope.prototype.contains=function(d){return d.x>=this.left&&d.x<=this.right&&d.y>=this.bottom&&d.y<=this.top};TGOS.TGLineString=function(d){this.path=d;this.renderer=null;this.Envelope=new TGOS.TGEnvelope(0,0,0,0);this.updateEnvelope()};TGOS.extend(TGOS.TGGeometry,TGOS.TGLineString);TGOS.TGLineString.prototype.type="TGLineString"; TGOS.TGLineString.prototype.nearestPoint=function(d,a,b){var f=null,e=null,g=Infinity;void 0!==a&&(g=a);var h=!0;void 0!==b.snapEdge&&(h=b.snapEdge);a=!0;void 0!==b.snapVertex&&(a=b.snapVertex);if(d instanceof TGOS.TGPoint&&(h||a)){if(a){var l=d.x,n=d.y;b=Infinity;for(a=0;ad&&(d=30),120b.sclientx-f.clientX||-2>b.sclienty-f.clientY)b.dragMoved=!0; DetachEvent(document.body,"mousemove",b.textMove,!0);DetachEvent(document.body,"mouseup",b.endDrag,!0);!b.dragMoved&&b.editable?null!=b.clickCallback&&b.clickCallback.call(this,b):null!=b.movedCallback&&b.movedCallback.call(this,b)};this.textMove=function(f){f=b.toMapPoint(f.clientX,f.clientY);f.x-=b.soffsetx;f.y-=b.soffsety;b.setPosition(f);b.editable&&null!=b.moveCallback&&b.moveCallback.call(this,b)};this.textDrag=function(f){b.sclientx=f.clientX;b.sclienty=f.clientY;var e=b.toMapPoint(b.sclientx, b.sclienty);b.soffsetx=e.x-b.position.x;b.soffsety=e.y-b.position.y;b.dragMoved=!1;f.cancelBubble=!0;f.stopPropagation&&f.stopPropagation();AttachEvent(document.body,"mousemove",b.textMove,!0);AttachEvent(document.body,"mouseup",b.endDrag,!0)};this.setClickCallback=function(f){this.clickCallback=f};this.setMoveCallback=function(f){this.moveCallback=f};this.setMovedCallback=function(f){this.movedCallback=f};a&&this.setOptions(a)};TGOS.extend(TGOS.Graphic,TGOS.TGLabel);var d=TGOS.TGLabel.prototype; d.font="";d.fontSize=12;d.fontWeight="normal";d.fontColor="#000000";d.opacity=1;d.backgroundColor="";d.position=null;d.label="";d.title="";d.zIndex;d.offset=null;d.visible=!0;d.map=null;d.mapbase=null;d.elem=null;d.clone=function(){var a={font:this.getFont(),fontSize:this.getFontSize(),fontWeight:this.getFontWeight(),fontColor:this.getFontColor(),opacity:this.getOpacity(),backgroundColor:this.getBackgroundColor(),position:this.getPosition(),label:this.getLabel(),title:this.getTitle(),offset:this.getOffset()}; return new TGOS.TGLabel(a)};d.getEventElement=function(){return this.elem};d.isPointInEnvelope=function(){return null};d.update=function(){if(this.map){switch(this.map.getCoordSys()){case TGOS.TGCoordSys.EPSG3857:this.mapbase.FromMapPoint(this.position.x,this.position.y);var a=TGOS.WGS84ToGoo(this.position.x,this.position.y),b=this.mapbase.FromMapPoint(a.x,a.y);break;case TGOS.TGCoordSys.EPSG3826:b=this.mapbase.FromMapPoint(this.position.x,this.position.y);break;case TGOS.TGCoordSys.EPSG3825:b=this.mapbase.FromMapPoint(this.position.x, this.position.y)}a=b.x;b=b.y;this.offset&&(a+=this.offset.x,b+=this.offset.y);this.elem.transform("t"+a+","+b)}};d.setVisible=function(a){this.elem&&(1==a?this.elem.show():0==a&&this.elem.hide());this.visible=a;TGOS.TGEvent.trigger(this,"visible_changed")};d.getVisible=function(){return this.visible};d.setZIndex=function(a,b){void 0!=a&&this.elem&&(this.zIndex=a,this.map.overlay.updateArrayOrder(this),this.map.overlay.updateElementOrder(this),TGOS.TGEvent.trigger(this,"zindex_changed"))};d.getZIndex= function(){return this.zIndex};d.setFont=function(a){this.font=a;this.elem&&this.elem.attr({"font-family":this.font})};d.getFont=function(){return this.font};d.setFontSize=function(a){this.fontSize=a;this.elem&&this.elem.attr({"font-size":this.fontSize})};d.getFontSize=function(){return this.fontSize};d.setSize=function(a){this.size=a};this.getSize=function(){return this.size};d.setFontColor=function(a){this.fontColor=a;this.elem&&this.elem.attr({fill:this.fontColor})};d.getFontColor=function(){return this.fontColor}; d.setOpacity=function(a){this.opacity=a;this.elem&&this.elem.attr({opacity:this.opacity})};d.getOpacity=function(){return this.opacity};d.setBackgroundColor=function(a){this.backgroundColor=a};d.getBackgroundColor=function(){return this.backgroundColor};d.setPosition=function(a){this.position=a;this.update();TGOS.TGEvent.trigger(this,"position_changed")};d.getPosition=function(){return this.position};d.setLabel=function(a){this.label=a;this.elem&&this.elem.attr({text:this.label});TGOS.TGEvent.trigger(this, "label_changed")};d.getLabel=function(){return this.label};d.setTitle=function(a){this.title=a;this.elem&&(this.elem.attr({title:this.title}),TGOS.TGEvent.trigger(this,"title_changed"))};d.getTitle=function(){return this.title};d.setFontWeight=function(a){this.fontWeight=a;this.elem&&this.elem.attr({"font-weight":this.fontWeight})};d.getFontWeight=function(){return this.fontWeight};d.destroy=function(){this.map&&(this.map.overlay.remove(this),this.elem&&this.elem.remove())};d.getOffset=function(){return this.offset}; d.setOffset=function(a){a instanceof TGOS.TGPoint&&(this.offset=a,this.update())};d.setMap=function(a){this.destroy();null==a&&this.map?(this.map=null,TGOS.TGEvent.clearInstanceListeners(this)):a instanceof TGOS.TGOnlineMap&&(this.map=a,paper=this.getPaper(),this.elem=paper.text(0,0,this.label),this.map.overlay.add(this),this.mapbase=this.map.getMapBase(),this.elem.attr({"font-family":this.font,fill:this.fontColor,"font-weight":this.fontWeight,"font-size":this.fontSize,text:this.label,opacity:this.opacity}), this.bindEvents(),this.update())};d.getMap=function(){return this.map};d.getMapBase=function(){return this.mapbase};d.editable=!1;d.getEditable=function(){return this.editable};d.setEditable=function(a){this.editable=a;this.setDraggable(a)};d.draggable=!1;d.getDraggable=function(){return this.draggable};d.setDraggable=function(a){this.draggable=a;TGOS.TGEvent.trigger(this,"draggable_changed");this.elem&&(this.elem&&1==a?this.elem.mousedown(this.textDrag):this.elem&&0==a&&this.elem.unmousedown(this.textDrag))}; d.clickable=!1;d.getClickable=function(){return this.clickable};d.setClickable=function(a){"boolean"===typeof a&&((this.clickable=a)?TGOS.TGEvent.releaseEventLock(this,"click"):TGOS.TGEvent.lockEvent(this,"click"),TGOS.TGEvent.trigger(this,"clickable_changed"))};d.advancedLayer=null;d.getAdvancedLayer=function(){return this.advancedLayer};d.setAdvancedLayer=function(a){this.advancedLayer=a};d.getPaper=function(){return null!=this.advancedLayer?this.advancedLayer.paper.main:this.map.getPaper()};d.getShadowPaper= function(){return null!=this.advancedLayer?this.advancedLayer.paper.shadow:this.map.getShadowPaper()};d.setOptions=function(a){void 0!==a.zIndex&&this.setZIndex(a.zIndex);a.font&&this.setFont(a.font);a.fontColor&&this.setFontColor(a.fontColor);a.fontWeight&&this.setFontWeight(a.fontWeight);a.fontSize&&this.setFontSize(a.fontSize);a.label&&this.setLabel(a.label);a.backgroundColor&&this.setBackgroundColor(a.backgroundColor);void 0!==a.opacity&&this.setOpacity(a.opacity);void 0!==a.clickable&&this.setClickable(a.clickable); void 0!==a.draggable&&this.setDraggable(a.draggable);a.position&&this.setPosition(a.position);a.map&&this.setMap(a.map);this.update()};TGOS.RegisterEvent(TGOS.TGLabel,"label_changed zindex_changed click dblclick rightclick mousemove mousedown mouseup mouseover mouseout".split(" "))})();TGOS.TGInfoWindow=function(d,a,b){var f="",e=this,g,h;var l=document.createElement("img");var n=document.createElement("div");var t=document.createElement("div");var k=document.createElement("div");document.createElement("div");l.src=TGOS.RES_PATH+"Sample/Angle.png";l.style.position="absolute";l.style.height="21px";l.style.width="34px";l.style.zIndex=1E6;n.style.position="absolute";n.style.border="solid 1px #AAAAAA";n.style.backgroundColor="#ffffff";n.style.opacity=1;n.style.borderRadius="5px";n.style.overflow= "auto";t.style.width="auto";t.style.height="auto";t.style.position="absolute";t.style.overflow="auto";t.style.margin="10px";t.style["word-break"]="break-all";k.style.position="absolute";k.top="5px";k.style.width="15px";k.style.height="15px";k.style.overflow="auto";k.style.right="5px";k.style.zIndex=1E6;k.style.backgroundImage='url("'+TGOS.RES_PATH+'Sample/Close.png")';this.onCloseClick=function(I){e.close()};AttachEvent(k,"click",this.onCloseClick);n.appendChild(t);var p=100,E=new TGOS.TGSize(0,0), H=1E6;if(void 0!==b||null!=b)void 0!==b.maxWidth&&(p=b.maxWidth),void 0!==b.pixelOffset&&(E=b.pixelOffset),void 0!==b.optzIndex&&(H=b.optzIndex);var B=p,G=a||new TGOS.TGPoint(0,0),J=E,C=H,L=!0;this.getElement=function(){return n};this.open=function(I){I.infoWindowLayer.containing(this)?this.update():(I.getHPack().appendChild(n),I.getHPack().appendChild(l),I.getHPack().appendChild(k),I.infoWindowLayer.add(this),g=I,h=g.getMapBase(),n.style.zIndex=C,t.innerHTML="

"+f+"

",800B?(n.style.width=B+20+"px",n.style.maxWidth=B+20+"px"):(n.style.width="40px",n.style.maxWidth="40px"),l.style.display="inline",k.style.display="inline",n.style.height=t.scrollHeight+20+"px",this.update(),this.panToCenter())};this.close=function(){g&&g.infoWindowLayer.containing(this)&&(TGOS.TGEvent.trigger(this,"closeclick"),g.infoWindowLayer.remove(this),l.parentNode&&l.parentNode.removeChild(l),k.parentNode&&k.parentNode.removeChild(k))};this.setContent=function(I){"string"== typeof I?f=I:I instanceof HTMLElement&&t.appendChild(I);f=I;t.innerHTML='

'+f+"

";n.style.width=t.scrollWidth+40>B?B+40+"px":t.scrollWidth+40+"px";n.style.height=t.scrollHeight+30+"px";TGOS.TGEvent.trigger(this,"content_changed")};this.setPosition=function(I){I instanceof TGOS.TGPoint&&(I.x!==G.x||I.y!==G.y)&&(G=I,this.update(),TGOS.TGEvent.trigger(this,"position_changed"))};this.getPosition=function(){return G};this.getContentPane=function(){return t};this.setMaxWidth= function(I){B=I;n.style.width=t.scrollWidth+40>B?B+40+"px":t.scrollWidth+40+"px";n.style.height=t.scrollHeight+30+"px"};this.setZIndex=function(I){I!==C&&(C=I,n.style.zIndex=I,l.style.zIndex=I,k.style.zIndex=I,this.update(),TGOS.TGEvent.trigger(this,"zindex_changed"))};this.getZIndex=function(){return C};this.setPixelOffset=function(I){J=I;this.update()};this.disableAutoPan=function(I){"boolean"==typeof I&&(L=I)};this.putOpacity=function(I){n.style.opacity=I;l.style.opacity=I;k.style.opacity=I;n.style.filter= "alpha(opacity="+100*I+")";l.style.filter="alpha(opacity="+100*I+")";k.style.filter="alpha(opacity="+100*I+")"};this.panToCenter=function(){if(0==L&&h&&g){var I=h.FromMapPoint(G.x,G.y),Q=parseInt(I.x)-n.offsetWidth/2;I=parseInt(I.y)-n.offsetHeight/2;h.ToMapPoint(Q,I);g.setCenter(G)}};this.setMessageText=function(I){this.setContent(I)};this.setOptions=function(I){void 0!=I&&("boolean"==typeof I.disableAutoPan&&this.disableAutoPan(I.disableAutoPan),I.position instanceof TGOS.TGPoint&&this.setPosition(I.position), "number"==typeof I.maxWidth&&this.setMaxWidth(I.maxWidth),I.pixelOffset instanceof TGOS.TGSize&&this.setPixelOffset(I.pixelOffset),"number"==typeof I.zIndex&&this.setZIndex(I.zIndex),"string"==typeof I.messageText&&this.setMessageText(I.messageText),"number"==typeof I.opacity&&this.putOpacity(I.opacity),this.update())};this.update=function(){if("undefined"!=typeof h&&g){switch(g.getCoordSys()){case TGOS.TGCoordSys.EPSG3857:var I=TGOS.WGS84ToGoo(G.x,G.y);I=h.FromMapPoint(I.x,I.y);break;case TGOS.TGCoordSys.EPSG3826:I= h.FromMapPoint(G.x,G.y);break;case TGOS.TGCoordSys.EPSG3825:I=h.FromMapPoint(G.x,G.y)}n.style.left=parseInt(I.x)+J.width+"px";n.style.top=parseInt(I.y)-19-parseInt(n.offsetHeight)+J.height+"px";l.style.left=parseInt(I.x)+J.width+"px";l.style.top=parseInt(I.y)-19+J.height+"px";k.style.left=parseInt(I.x)+n.clientWidth+J.width-20+"px";k.style.top=parseInt(n.style.top)+5+"px"}};this.setContent(d);this.setOptions({position:a});this.setOptions(b)}; TGOS.RegisterEvent(TGOS.TGInfoWindow,["closeclick","content_changed","position_changed","zindex_changed","domready"]);TGOS.TGImage=function(d,a,b,f,e){var g="";this.size=a instanceof TGOS.TGSize?a:new TGOS.TGSize(32,32);e instanceof TGOS.TGSize&&(this.scaledSize=e);this.anchor=f instanceof TGOS.TGPoint?f:new TGOS.TGPoint(this.size.width/2-1,this.size.height-1);this.origin=b instanceof TGOS.TGPoint?b:new TGOS.TGPoint(0,0);this.setOptions=function(h){h.scale&&(this.scale=h.scale);h.hotSpot&&(this.hotSpot=h.hotSpot)};this.setUrl=function(h){"string"==typeof h&&(g=h)};this.getUrl=function(){return g};this.setUrl(d)}; TGOS.extend(TGOS.MVCObject,TGOS.TGImage);TGOS.TGSymbol=function(){var d={FORWARD_OPEN_ARROW:1,BACKWARD_OPEN_ARROW:3};TGOS.TGSymbolStyle={FORWARD_CLOSED_ARROW:0,FORWARD_OPEN_ARROW:1,BACKWARD_CLOSED_ARROW:2,BACKWARD_OPEN_ARROW:3,CIRCLE:4,DOUBLE_CIRCLE:5,TRIPLE_CIRCLE:6,CIRCLE_SPOT:7,TRIANGLE:8,INVERT_TRIANGLE:9,SQUARE:10,PENTAGON:11,HEXAGON:12,OCTAGON:13,PENTASTAR:14,HEXASTAR:15};var a=function(){this.anchor=new TGOS.TGPoint(0,0);this.symbolStyle=TGOS.TGSymbolStyle.CIRCLE;this.yPixel=this.xPixel=48;this.rotation=0;this.opacity=1;this.fillColor= "#ffffff";this.fillOpacity=0;this.strokeColor="#000000";this.strokeWeight=2;this.strokeOpacity=1};TGOS.extend(TGOS.MVCObject,a);a.noFill=function(b){for(var f in d)if(d[f]==b)return!0;return!1};a.SymbolPath="M0 0 L 100 50 L0 100L50 50Z;M0 0 L 100 50 L0 100;M100 0 L 0 50 L100 100L50 50Z;M100 0 L 0 50 L100 100;M0 50 A 50 50 0 0 1 100 50 A50 50 0 0 1 0 50z;M0 50A50 50 0 0 1 100 50 A50 50 0 0 1 0 50zM25 50A25 25 0 0 1 75 50 A25 25 0 0 1 25 50z;M0 50A50 50 0 0 1 100 50 A50 50 0 0 1 0 50zM16.67 50A33.33 33.33 0 0 1 83.33 50 A33.33 33.33 0 0 1 16.67 50zM33.33 50A16.67 16.67 0 0 1 66.67 50 A16.67 16.67 0 0 1 33.33 50z;M0 50A50 50 0 0 1 100 50 A50 50 0 0 1 0 50ZM45 45L55 55M55 45L45 55;M50 0L7 75L93 75Z;M93 25L7 25L50 100Z;M0 0L100 0L100 100L0 100Z;M50 0L2 35L21 90L79 90L98 35Z;M50 0L7 25L7 75L50 100L93 75L93 25Z;M50 0L15 15L0 50L15 85L50 100L85 85L100 50L85 15Z;M50 0L35 30L2 35 L26 58L21 90L50 75L79 90L74\t58L98 35L65\t30Z;M50,0L38,28L7,25L25,50L7,75L37,72L50,100L62,72L93,75L75,50L93,25L63,28Z".split(";"); return a}();TGOS.TGEvent=function(){var d=util.getInternetExplorerVersion(),a={standardDomMouseEvents:{click:"click",mousemove:"mousemove",mousedown:"mousedown",mouseover:"mouseover",mouseout:"mouseout",mouseup:"mouseup",dblclick:"dblclick",rightclick:"rightclick"},RIGHTBUTTON:2};a.LEFTBUTTON=0>d?0:1;TGOS.MapsEventListener=function(){};TGOS.OverlayCompleteEvent=function(b,f,e){this.overlay=b;this.type=f;this.action=e?e:""};TGOS.TGMouseEvent=function(b,f){Object.defineProperty(this,"type",{value:f||b.type});this.mapListener_= null;this.stop=function(){a.removeListener(this.mapListener_);this.mapListener_=null};this.stopPropagation=function(){b.stopPropagation&&b.stopPropagation();b.cancelBubble=!0};this.point=new TGOS.TGPoint};a.addListener_=function(b,f,e,g,h){if(b&&f&&b.events&&!(0>b.events.indexOf(f))){var l=b[f+"_"];l||(b[f+"_"]=[],l=b[f+"_"]);if(l)return b={target_:b,eventName_:f,targetQueue_:f+"_",handler_:e,executeLimit:h,capture:g},l.push(b),b}};a.addDomListener=function(b,f,e,g){return a.addListener_(b,f,e,g, Infinity)};a.addDomListenerOnce=function(b,f,e,g){return a.addListener_(b,f,e,g,1)};a.addListener=function(b,f,e,g){return a.addListener_(b,f,e,g,Infinity)};a.addListenerOnce=function(b,f,e,g){return a.addListener_(b,f,e,g,1)};a.clearInstanceListeners=function(b){if(b.events)for(var f=0;fb||f.splice(b,1)}};a.trigger_=function(b,f){var e=b[f+"_"];if(!e||0>=e.length)return!1;for(var g=0;g=e[g].executeLimit&&a.removeListener(e[g]))}; a.trigger=function(b,f){a.trigger_(b,f)};a.releaseEventLock=function(b,f){b&&b.events&&b.events.length&&f&&b.lockEvt&&0<=b.lockEvt.indexOf(f)&&(f=b.lockEvt.indexOf(f),0>f||b.lockEvt.splice(f,1))};a.lockEvent=function(b,f){b&&b.events&&b.events.length&&f&&(b.lockEvt||(b.lockEvt=[]),0<=b.lockEvt.indexOf(f)||b.lockEvt.push(f))};return a}();(function(){var d=TGOS.RES_PATH+"marker2.png",a=TGOS.RES_PATH+"shadow2.png";TGOS.TGMarker=function(f,e,g,h,l){var n=this;this.toMapPoint=function(t,k){var p=n.map.getMapBase(),E=p.getPackageOffset();t=p.ToMapPoint(t-E.x,k-E.y);switch(n.map.getCoordSys()){case TGOS.TGCoordSys.EPSG3857:var H=TGOS.GooToWGS84(t.x,t.y);H=new TGOS.TGPoint(H.x,H.y);break;case TGOS.TGCoordSys.EPSG3826:H=t;break;case TGOS.TGCoordSys.EPSG3825:H=t}return H};this.endDrag=function(t){if(2n.sclientx-t.clientX||-2>n.sclienty-t.clientY)n.dragMoved=!0;DetachEvent(document.body,"mousemove",n.markMove,!0);DetachEvent(document.body,"mouseup",n.endDrag,!0);!n.dragMoved&&n.editable?null!=n.clickCallback&&n.clickCallback.call(this,n):null!=n.movedCallback&&n.movedCallback.call(this,n)};this.markMove=function(t){t=n.toMapPoint(t.clientX,t.clientY);t.x-=n.soffsetx;t.y-=n.soffsety;n.setPosition(t);n.editable&&null!=n.moveCallback&&n.moveCallback.call(this,n)};this.markDrag=function(t){n.sclientx= t.clientX;n.sclienty=t.clientY;var k=n.toMapPoint(n.sclientx,n.sclienty);n.soffsetx=k.x-n.position.x;n.soffsety=k.y-n.position.y;n.dragMoved=!1;t.cancelBubble=!0;t.stopPropagation&&t.stopPropagation();AttachEvent(document.body,"mousemove",n.markMove,!0);AttachEvent(document.body,"mouseup",n.endDrag,!0)};this.setClickCallback=function(t){this.clickCallback=t};this.setMoveCallback=function(t){this.moveCallback=t};this.setMovedCallback=function(t){this.movedCallback=t};e instanceof TGOS.TGPoint&&(this.position= e);void 0!==h&&null!=h&&(this.icon=h);void 0!==g&&null!=g&&(this.title=g);this.getNode=function(){if(this.map&&this.advancedLayer){var t=this.getAdvancedLayer();return null!=t?[t.div.main,t.div.shadow]:this.map.getPanes().graphicLayer}};l&&this.setMarkerOptions(l);f&&this.setMap(f)};TGOS.extend(TGOS.Graphic,TGOS.TGMarker);var b=TGOS.TGMarker.prototype;b.elem=null;b.map=null;b.gPos=null;b.clone=function(){var f=new TGOS.TGMarker(null,this.getPosition(),this.getTitle(),this.getIcon());f.setShadow(this.getShadow()); f.setInfoAnchorPoint(this.getInfoAnchorPoint());f.setFlat(this.getFlat());return f};b.isPointInEnvelope=function(f,e,g){var h=null,l=this.position;if(void 0!==l&&null!=l){var n=this.icon;if(void 0!==n&&null!=n){h=l.x-n.anchor.x*g;var t=l.x+n.anchor.x*g,k=l.y+n.anchor.y*g,p=l.y-n.anchor.y*g;this.icon instanceof TGOS.TGImage?(t=l.x+(n.size.width-n.anchor.x)*g,p=l.y-(n.size.height-n.anchor.y)*g):this.icon instanceof TGOS.TGSymbol&&(t=l.x+(n.xPixel-n.anchor.x)*g,p=l.y-(n.yPixel-n.anchor.y)*g);h=f>=h&& f<=t&&e>=p&&e<=k?!0:!1}}return h};b.getEnvelope=function(){return new TGOS.TGEnvelope(this.position.x,this.position.y,this.position.x,this.position.y)};b.getBounds=function(){return new TGOS.TGEnvelope(this.position.x,this.position.y,this.position.x,this.position.y)};b.setMap=function(f){if(null===f)this.destroy(),this.map=null;else if(this.destroy(),f instanceof TGOS.TGOnlineMap){(this.map=f)&&this.map.getCoordSys()==TGOS.TGCoordSys.EPSG3857&&(this.gPos=TGOS.WGS84ToGoo(this.position.x,this.position.y)); this.map.overlay.add(this);this.getPaper();f=this.getShadowPaper();var e=this.shadow?this.shadow.getUrl():a;this.sImg=f.image(e,0,0,this.shadow.size.width,this.shadow.size.height);1!=this.flat&&0!=this.visible||this.sImg.hide();this.redrawMarker();this.update()}};b.getMap=function(){return this.map};b.getMapBase=function(){if(this.map)return this.map.getMapBase()};b.destroy=function(){this.map&&(this.elem&&this.elem.remove(),this.sImg&&this.sImg.remove(),this.map.overlay.remove(this),this.sImg=this.elem= null)};b.getEventElement=function(){return this.elem};b.title="";b.getTitle=function(){return this.title};b.setTitle=function(f){this.title=f;this.elem&&(this.elem.attr({title:this.title}),TGOS.TGEvent.trigger(this,"title_changed"))};b.setPath=function(f){this.setPosition(f)};b.position=null;b.getPosition=function(){return this.position};b.setPosition=function(f){f instanceof TGOS.TGPoint&&(this.position=f,this.map&&this.map.getCoordSys()==TGOS.TGCoordSys.EPSG3857&&(this.gPos=TGOS.WGS84ToGoo(this.position.x, this.position.y)),this.update(),TGOS.TGEvent.trigger(this,"position_changed"))};this.infoAnchorPosition=null;b.getInfoAnchorPoint=function(){return this.infoAnchorPoint};b.setInfoAnchorPoint=function(f){this.infoAnchorPoint=f};b.icon=new TGOS.TGImage(d,new TGOS.TGSize(31,30),new TGOS.TGPoint(0,0),new TGOS.TGPoint(9,28));b.getIcon=function(){return this.icon};b.setIcon=function(f){if(f instanceof TGOS.TGImage||f instanceof TGOS.TGSymbol)this.icon=f,this.redrawMarker(),this.update(),TGOS.TGEvent.trigger(this, "icon_changed")};b.clickable=!1;b.getClickable=function(){return this.clickable};b.setClickable=function(f){"boolean"===typeof f&&((this.clickable=f)?TGOS.TGEvent.releaseEventLock(this,"click"):TGOS.TGEvent.lockEvent(this,"click"),TGOS.TGEvent.trigger(this,"clickable_changed"))};b.redrawMarker=function(){if((this.icon instanceof TGOS.TGImage||this.icon instanceof TGOS.TGSymbol)&&this.map){this.elem&&this.elem.remove();var f=this.getPaper();if(this.icon instanceof TGOS.TGImage)if(this.fitImageSize){var e= document.createElement("img"),g=this;e.onload=function(){var h=b.icon.size.width,l=b.icon.size.height;try{h=this.width,l=this.height}catch(n){}b.elem=f.image(g.icon.getUrl(),0,0,h,l);!1===b.visible?b.elem.hide():b.elem.show();null!=b.cursor&&b.elem.attr({cursor:b.cursor});null!=b.title&&b.elem.attr({title:b.title});g.map.overlay.updateElementOrder(g);g.bindEvents();g.update()};e.src=this.icon.getUrl()}else this.icon.scale?(e=document.createElement("img"),g=this,e.onload=function(h){g.icon.size.width= h.srcElement.width*g.icon.scale;g.icon.size.height=h.srcElement.height*g.icon.scale;b.elem=g.icon.scaledSize?f.image(g.icon.getUrl(),0,0,g.icon.scaledSize.width,g.icon.scaledSize.height):f.image(g.icon.getUrl(),0,0,g.icon.size.width,g.icon.size.height);!1===b.visible?b.elem.hide():b.elem.show();null!=b.cursor&&b.elem.attr({cursor:b.cursor});null!=b.title&&b.elem.attr({title:b.title});g.map.overlay.updateElementOrder(g);g.bindEvents();g.update()},e.src=this.icon.getUrl()):(this.elem=this.icon.scaledSize? f.image(this.icon.getUrl(),0,0,this.icon.scaledSize.width,this.icon.scaledSize.height):f.image(this.icon.getUrl(),0,0,this.icon.size.width,this.icon.size.height),!1===this.visible?this.elem.hide():this.elem.show(),void 0!==this.cursor&&null!=this.cursor&&this.elem.attr({cursor:this.cursor}),void 0!==this.title&&null!=this.title&&this.elem.attr({title:this.title}),this.map.overlay.updateElementOrder(this),this.bindEvents(),this.update());else if(this.icon instanceof TGOS.TGSymbol){e=this.icon.symbolStyle in TGOS.TGSymbol.SymbolPath?TGOS.TGSymbol.SymbolPath[this.icon.symbolStyle]:this.icon.symbolStyle;if(!e)throw"Invalid SymbolStyle or path";this.elem=f.path(e);this.bbox_=this.elem.getBBox(!0);e=TGOS.TGSymbol.noFill(this.icon.symbolStyle);this.elem.attr({opacity:this.icon.opacity,fill:this.icon.fillColor,"fill-opacity":e?0:this.icon.fillOpacity,stroke:this.icon.strokeColor,"stroke-opacity":this.icon.strokeOpacity,"stroke-width":this.icon.strokeWeight});!1===this.visible?this.elem.hide():this.elem.show(); void 0!==this.cursor&&null!=this.cursor&&this.elem.attr({cursor:this.cursor});void 0!==this.title&&null!=this.title&&this.elem.attr({title:this.title});this.map.overlay.updateElementOrder(this);this.bindEvents();this.update()}}};b.icon_changed=function(){this.redrawMarker()};b.visible=!0;b.getVisible=function(){return this.visible};b.setVisible=function(f,e){this.visible=f;this.map&&(!0===this.visible?(this.elem.show(),!1===this.flat&&this.sImg.show()):(this.elem.hide(),this.sImg.hide()),e||this.update(), TGOS.TGEvent.trigger(this,"visible_changed"))};b.cursor=null;b.getCursor=function(){return this.cursor};b.setCursor=function(f){this.cursor=f;this.elem&&(this.elem.attr({cursor:this.cursor}),TGOS.TGEvent.trigger(this,"cursor_changed"))};b.zIndex=0;b.getZIndex=function(){return this.zIndex};b.setZIndex=function(f){this.zIndex=parseInt(f);this.map&&(this.map.overlay.updateArrayOrder(this),this.map.overlay.updateElementOrder(this),TGOS.TGEvent.trigger(this,"zindex_changed"))};b.editable=!1;b.getEditable= function(){return this.editable};b.setEditable=function(f){this.editable=f;this.setDraggable(f)};b.draggable=!1;b.getDraggable=function(){return this.draggable};b.setDraggable=function(f){this.draggable=f;TGOS.TGEvent.trigger(this,"draggable_changed");this.elem&&(this.elem&&1==f?this.elem.mousedown(this.markDrag):this.elem&&0==f&&this.elem.unmousedown(this.markDrag))};b.flat=!1;b.getFlat=function(){return this.flat};b.setFlat=function(f){this.flat=f;this.sImg&&(!0===this.flat?this.sImg.hide():this.sImg.show(), TGOS.TGEvent.trigger(this,"flat_changed"))};b.shadow=new TGOS.TGImage(a,new TGOS.TGSize(31,30),new TGOS.TGPoint(0,0),new TGOS.TGPoint(9,25));b.getShadow=function(){return this.shadow};b.setShadow=function(f){this.shadow=f;TGOS.TGEvent.trigger(this,"shadow_changed")};b.advancedLayer=null;b.getAdvancedLayer=function(){return this.advancedLayer};b.setAdvancedLayer=function(f){this.advancedLayer=f};b.getPaper=function(){return null!=this.advancedLayer?this.advancedLayer.paper.main:this.map.getPaper()}; b.getShadowPaper=function(){return null!=this.advancedLayer?this.advancedLayer.paper.shadow:this.map.getShadowPaper()};b.fitImageSize=!1;b.setFitImageSize=function(f){this.fitImageSize=f};b.setMarkerOptions=function(f){f&&(void 0!==f.advancedLayer&&this.setAdvancedLayer(f.advancedLayer),void 0!==f.visible&&this.setVisible(f.visible),void 0!=f.icon&&this.setIcon(f.icon),void 0!==f.shadow&&this.setShadow(f.shadow),void 0!=f.title&&this.setTitle(f.title),void 0!==f.position&&this.setPosition(f.position), void 0!==f.infoAnchor&&this.setInfoAnchorPoint(f.infoAnchor),void 0!==f.clickable&&this.setClickable(f.clickable),void 0!==f.cursor&&this.setCursor(f.cursor),void 0!=f.zIndex&&this.setZIndex(f.zIndex),void 0!==f.draggable&&this.setDraggable(f.draggable),void 0!==f.flat&&this.setFlat(f.flat),void 0!==f.shape&&this.setShape(f.shape),void 0!==f.fitImageSize&&this.setFitImageSize(f.fitImageSize))};b.update=function(){if(this.position&&this.visible&&this.elem&&this.map){switch(this.map.getCoordSys()){case TGOS.TGCoordSys.EPSG3857:var f= this.gPos;break;default:f=this.position}var e=this.map.getMapBase();if(this.map.getRawBound().contains(f)){this.visible&&(this.elem.show(),!0!==this.flat&&this.sImg.show());f=e.FromMapPoint(f.x,f.y);if(this.icon instanceof TGOS.TGImage){e=f.x-this.icon.anchor.x;var g=f.y-this.icon.anchor.y;this.icon.hotSpot&&(e=f.x-this.icon.hotSpot.x,g=f.y-this.icon.hotSpot.y);this.elem.attr({x:e,y:g});this.elem.attr({"clip-rect":e+","+g+","+this.icon.size.width+","+this.icon.size.height})}else if(this.icon instanceof TGOS.TGSymbol){if(!this.bbox_){this.bbox_=this.elem.getBBox(!0);return}this.elem.transform("t"+(f.x-this.icon.anchor.x)+","+(f.y-this.icon.anchor.y)+"r"+this.icon.rotation+","+this.icon.anchor.x+","+this.icon.anchor.y+"s"+this.icon.xPixel/this.bbox_.width+","+this.icon.yPixel/this.bbox_.height+",0,0")}else return;!1===this.flat&&this.sImg.attr({x:f.x-this.shadow.anchor.x,y:f.y-this.shadow.anchor.y})}else this.elem.hide(),this.sImg.hide()}};TGOS.RegisterEvent(TGOS.TGMarker,"clickable_changed icon_changed position_changed title_changed visible_changed zindex_changed click mousedown mouseup mouseover mouseout mousemove cursor_changed draggable_changed flat_changed shadow_changed shape_changed dblclick rightclick".split(" "))})();TGOS.TGDrawing=function(){TGOS.TGOverlayType={NONE:"NONE",CIRCLE:"CIRCLE",MARKER:"MARKER",POLYGON:"POLYGON",LINESTRING:"LINESTRING",ENVELOPE:"ENVELOPE",LABEL:"LABEL",EDIT:"EDIT",MODIFY:"MODIFY"};TGOS.TGModifyType={STARTED:"STARTED",ATTRIBUTE:"ATTRIBUTE",SAVE:"SAVE",DELETE:"DELETE",CANCEL:"CANCEL"};var d=function(k,p,E,H){var B=this;this.manager=k;this.mode=p;this.active=!1;this.activeImage=E;this.inactiveImage=H;this.div=document.createElement("div");this.img=document.createElement("img");this.div.appendChild(this.img); this.setActive=function(G){this.active=G;this.img.src=this.active?B.activeImage:B.inactiveImage};this.destructor=function(){div.parentNode&&div.parentNode.removeChild(this.div);this.img=this.div=null};this.setActive(!1);this.div.onclick=function(){var G=B.manager.getDrawingMode()==B.mode?TGOS.TGOverlayType.NONE:B.mode;B.manager.setDrawingMode(G)}},a=function(k,p,E,H){var B=this;this.manager=k;this.mode=p;this.active=!0;this.enabledImage=E;this.disabledImage=H;this.div=document.createElement("div"); this.img=document.createElement("img");this.div.appendChild(this.img);this.setActive=function(G){this.active=G;this.img.src=this.active?B.enabledImage:B.disabledImage};this.destructor=function(){div.parentNode&&div.parentNode.removeChild(this.div);this.img=this.div=null};this.setActive(!0);this.div.onclick=function(){B.active&&B.manager.setModifyMode(B.mode)}},b=function(k){k.cancelBubble=!0;k.stopPropagation&&k.stopPropagation()},f=function(k,p){this.buttons=[];k&&(this.manager=k);this.position= TGOS.TGControlPosition.BOTTOM_RIGHT;this.div=document.createElement("div");util.disableSelect(this.div);this.table=document.createElement("table");this.div.appendChild(this.table);this.row=this.table.insertRow(-1);k.map&&this.setMap(k.map);p&&this.setOptions(p)},e=f.prototype;e.setMap=function(k){this.map!=k&&(this.map=k,this.position&&k.controls[this.position].push(this.div))};e.setImages=function(k){this.images=k};e.setVisible=function(k){this.div.style.display=k?"":"none"};e.setPosition=function(k){if(this.manager.map){var p= this.manager.map.controls[this.position].indexOf(this.div);0<=p&&(this.manager.map.controls[this.position].removeAt(p),this.manager.map.controls[k].push(this.div),this.position=k)}};e.setOptions=function(k){k.images&&this.setImages(k.images);k.controlPosition&&this.setPosition(k.controlPosition);k.modifyModes&&this.setModes(k.modifyModes)};e.setButtonState=function(k,p){for(var E=!1,H=0;H=q.length&&(ca=!1);!p.moveGraphicByKey||M!=TGOS.TGOverlayType.MARKER&&M!=TGOS.TGOverlayType.LABEL||1>=q.length&&(ca=!0);Z=[];var na=p.options.modifyIndicateOptions.pseudo;switch(M){case TGOS.TGOverlayType.POLYGON:3> q.length&&(ca=!1);for(i=0;iq.length&&(ca=!1);for(i=0;ica.x?ca.x:Z.x,Z.yca.y?ca.y:Z.y)};this.getAllGraphics=function(){return O};this.takeAllGraphics= function(){this.setDrawingMode(TGOS.TGOverlayType.NONE,!0);var Z=[];for(i=0;i=ia){var la=W;W=ia;ia=la}ca=ia;ia+=12){var la=ca+Math.sin(ia*Math.PI/180)*ya,Ca=na+Math.cos(ia*Math.PI/180)*ya;p.map.getCoordSys()==TGOS.TGCoordSys.EPSG3857?(la=TGOS.TWD97toWGS84(la,Ca),la=new TGOS.TGPoint(la.x,la.y)):la=new TGOS.TGPoint(la,Ca);W.push(la)}ca=new TGOS.TGLineString(W);ca=new TGOS.TGLinearRing(ca);Z.push(ca);na=(new TGOS.TGPolygon(Z)).toGeoJson()}else if(ca==TGOS.TGOverlayType.POLYGON||ca==TGOS.TGOverlayType.LINESTRING)na=Z.getPath().toGeoJson();return na}, R,aa=function(Z,ca){Z=Z.slice();ca&&Z.pop();p.getDrawingMode()==TGOS.TGOverlayType.POLYGON?(ca=new TGOS.TGLineString(Z),ca=new TGOS.TGLinearRing(ca),ca=new TGOS.TGPolygon([ca])):ca=new TGOS.TGLineString(Z);p.map.getCoordSys()==TGOS.TGCoordSys.EPSG3857&&(ca=TGOS.Geometry.Transform(ca,TGOS.GooToWGS84));return ca},ea;this.enterEnvMode=function(){this.setDrawingMode(TGOS.TGOverlayType.ENVELOPE)};this.enterEnvelopeMode=function(){this.setDrawingMode(TGOS.TGOverlayType.ENVELOPE)};this.enterCircleMode=function(){this.setDrawingMode(TGOS.TGOverlayType.CIRCLE)}; this.enterPolyMode=function(){this.setDrawingMode(TGOS.TGOverlayType.POLYGON)};this.enterPolygonMode=function(){this.setDrawingMode(TGOS.TGOverlayType.POLYGON)};this.enterLineStrMode=function(){this.setDrawingMode(TGOS.TGOverlayType.LINESTRING)};this.enterLineMode=function(){this.setDrawingMode(TGOS.TGOverlayType.LINESTRING)};this.enterMarkMode=function(){this.setDrawingMode(TGOS.TGOverlayType.MARKER)};this.enterMarkerMode=function(){this.setDrawingMode(TGOS.TGOverlayType.MARKER)};this.enterLabelMode= function(){this.setDrawingMode(TGOS.TGOverlayType.LABEL)};this.enterEditMode=function(){this.setDrawingMode(TGOS.TGOverlayType.EDIT)};this.enterModifyMode=function(){this.setDrawingMode(TGOS.TGOverlayType.MODIFY)};this.graphicMoved=function(Z){if(Z){var ca="UNKNOWN";if(Z instanceof TGOS.TGMarker)ca="MARKER";else if(Z instanceof TGOS.TGLabel)ca="LABEL";else if(Z.getPath){var na=Z.getPath();if(na instanceof TGOS.TGEnvelope)ca="ENVELOPE";else if(na instanceof TGOS.TGCircle)ca="CIRCLE";else if(na instanceof TGOS.TGPolygon||na instanceof TGOS.TGMultiPolygon)ca="POLYGON";else if(na instanceof TGOS.TGLineString||na instanceof TGOS.TGMultiLineString)ca="LINESTRING"}Z=new TGOS.OverlayCompleteEvent(Z,ca,"MOVED");TGOS.TGEvent.trigger_(p,"graphic_moved",Z)}};this.cancelSegDrawing=function(){Q=null;if(null!=ea){ea.setMap(null);var Z=O.indexOf(ea);0<=Z&&O.splice(Z,1);ea=null}DetachEvent(V,"mousemove",ka);DetachEvent(V,"dblclick",da)};this.cancelEditingMode=function(){this.useDefaultControl&&(V.style.cursor="default"); for(i=0;i=Q.length&&(AttachEvent(V,"dblclick",da),ca==TGOS.TGOverlayType.POLYGON?ea=new TGOS.TGFill(p.map, null,p.options.polygonOptions):ca==TGOS.TGOverlayType.LINESTRING&&(ea=new TGOS.TGLine(p.map,null,p.options.polylineOptions)));var na=p.map.getMapBase(),ya=n(V);ca=Z.clientX-ya.x;Z=Z.clientY-ya.y;na=na.ToMapPoint(ca,Z);na=p.snapToGraphics(na);Q.push(na);U||=p.map.getPaper().path("M"+ca+","+Z);ca=aa(Q);null!=ea&&ea.setPath(ca)}},ka=function(Z){var ca=Z.clientX;Z=Z.clientY;if(B!=ca||G!=Z){B=ca;G=Z;DEBUG_MODE&&console.log("drawMove.");E||(E=!Ha(ca,Z,J,C))&&DEBUG_MODE&&console.log("drawMoved.");var na= p.map.getMapBase(),ya=n(V);ca=na.ToMapPoint(ca-ya.x,Z-ya.y);ca=p.snapToGraphics(ca);!Q||0>=Q.length||!ea||(ca=aa(Q.concat(ca)),ea.setPath(ca))}},pa=function(Z){"tgoverlay"==Z.currentTarget.className&&(DEBUG_MODE&&console.log("drawStart."),util.disableDefault(Z),B=J=Z.clientX,G=C=Z.clientY,E=!1,AttachEvent(V,"mouseup",fa),AttachEvent(V,"mousemove",ka))},sa=function(Z){if("tgoverlay"==Z.currentTarget.className){util.disableDefault(Z);b(Z);DEBUG_MODE&&console.log("drawEnd.");DetachEvent(V,"mousemove", za);DetachEvent(V,"dblclick",sa);var ca=Z.clientX;Z=Z.clientY;var na=p.map.getMapBase(),ya=n(V);ca=na.ToMapPoint(ca-ya.x,Z-ya.y);ca=p.snapToGraphics(ca);p.map.getCoordSys()==TGOS.TGCoordSys.EPSG3857&&(ca=TGOS.Geometry.Transform(ca,TGOS.GooToWGS84),ca=new TGOS.TGPoint(ca.x,ca.y));Z=p.getDrawingMode();var W;na=Q[0];Z==TGOS.TGOverlayType.CIRCLE?W=p.createCircle(na,ca):Z==TGOS.TGOverlayType.ENVELOPE&&(W=p.createEnvelope(na,ca));Q=null;W&&p.addGraphic(W,Z);null!=ea&&(ea.setMap(null),ea=null)}},qa=function(Z){DEBUG_MODE&& console.log("simpleUp.");DetachEvent(V,"mouseup",qa);if(!E){var ca=p.getDrawingMode();Q||=[];0>=Q.length&&(AttachEvent(V,"dblclick",sa),ca==TGOS.TGOverlayType.CIRCLE?ea=new TGOS.TGFill(p.map,null,p.options.circleOptions):ca==TGOS.TGOverlayType.ENVELOPE&&(ea=new TGOS.TGFill(p.map,null,p.options.envelopeOptions)));ca=p.map.getMapBase();var na=n(V);Z=ca.ToMapPoint(Z.clientX-na.x,Z.clientY-na.y);Z=p.snapToGraphics(Z);p.map.getCoordSys()==TGOS.TGCoordSys.EPSG3857&&(Z=TGOS.Geometry.Transform(Z,TGOS.GooToWGS84), Z=new TGOS.TGPoint(Z.x,Z.y));Q.push(Z)}},za=function(Z){var ca=Z.clientX;Z=Z.clientY;if(B!=ca||G!=Z)if(B=ca,G=Z,DEBUG_MODE&&console.log("simpleMove."),E||(E=!Ha(ca,Z,J,C))&&DEBUG_MODE&&console.log("simpleMoved."),Q&&!(0>=Q.length)&&ea){var na=p.map.getMapBase(),ya=n(V);ca=na.ToMapPoint(ca-ya.x,Z-ya.y);ca=p.snapToGraphics(ca);p.map.getCoordSys()==TGOS.TGCoordSys.EPSG3857&&(ca=TGOS.Geometry.Transform(ca,TGOS.GooToWGS84),ca=new TGOS.TGPoint(ca.x,ca.y));Z=p.getDrawingMode();var W;na=Q[0];Z==TGOS.TGOverlayType.CIRCLE? W=p.createCircle(na,ca):Z==TGOS.TGOverlayType.ENVELOPE&&(W=p.createEnvelope(na,ca));ea&&ea.setPath(W)}},Da=function(Z){if("tgoverlay"==Z.currentTarget.className){DEBUG_MODE&&console.log("simpleStart.");util.disableDefault(Z);B=J=Z.clientX;G=C=Z.clientY;E=!1;Z=p.map.getMapBase();var ca=n(V);Z=Z.ToMapPoint(J-ca.x,C-ca.y);H=p.snapToGraphics(Z);p.map.getCoordSys()==TGOS.TGCoordSys.EPSG3857&&(Z=TGOS.Geometry.Transform(H,TGOS.GooToWGS84),H=new TGOS.TGPoint(Z.x,Z.y));AttachEvent(V,"mousemove",za);AttachEvent(V, "mouseup",qa)}},Ba=function(Z){if("tgoverlay"==Z.currentTarget.className){util.disableDefault(Z);b(Z);DetachEvent(V,"mousemove",Ia,!1);DetachEvent(V,"mouseup",Ba,!1);var ca=Z.clientX,na=Z.clientY;DEBUG_MODE&&console.log("dragEnd X = "+ca+", Y = "+na);Z=null;var ya=p.getDrawingMode();if(ya==TGOS.TGOverlayType.CIRCLE||ya==TGOS.TGOverlayType.ENVELOPE){var W=n(V);ca-=W.x;na-=W.y;ca=p.map.getMapBase().ToMapPoint(ca,na);ca=p.snapToGraphics(ca);p.map.getCoordSys()==TGOS.TGCoordSys.EPSG3857&&(ca=TGOS.Geometry.Transform(ca, TGOS.GooToWGS84),ca=new TGOS.TGPoint(ca.x,ca.y));ya==TGOS.TGOverlayType.CIRCLE?Z=p.createCircle(H,ca):ya==TGOS.TGOverlayType.ENVELOPE&&(Z=p.createEnvelope(H,ca))}Z&&p.addGraphic(Z,ya);null!=R&&(R.setMap(null),R=null)}},Ia=function(Z){var ca=Z.clientX;Z=Z.clientY;if(B!=ca||G!=Z){B=ca;G=Z;DEBUG_MODE&&console.log("dragMove.");var na=n(V);ca-=na.x;Z-=na.y;ca=p.map.getMapBase().ToMapPoint(ca,Z);ca=p.snapToGraphics(ca);p.map.getCoordSys()==TGOS.TGCoordSys.EPSG3857&&(ca=TGOS.Geometry.Transform(ca,TGOS.GooToWGS84), ca=new TGOS.TGPoint(ca.x,ca.y));var ya;Z=p.getDrawingMode();DEBUG_MODE&&console.log("Move ("+ca.x+","+ca.y+")-("+H.x+","+H.y+")");Z==TGOS.TGOverlayType.CIRCLE?ya=p.createCircle(H,ca):Z==TGOS.TGOverlayType.ENVELOPE&&(ya=p.createEnvelope(H,ca));R&&R.setPath(ya)}},Ka=function(Z){if("tgoverlay"==Z.currentTarget.className){util.disableDefault(Z);b(Z);B=L=Z.clientX;G=I=Z.clientY;DEBUG_MODE&&console.log("dragStart X = "+L+", Y = "+I);var ca=n(V);Z=L-ca.x;ca=I-ca.y;Z=p.map.getMapBase().ToMapPoint(Z,ca);H= p.snapToGraphics(Z);p.map.getCoordSys()==TGOS.TGCoordSys.EPSG3857&&(Z=TGOS.Geometry.Transform(H,TGOS.GooToWGS84),H=new TGOS.TGPoint(Z.x,Z.y));DEBUG_MODE&&console.log("clickPoint X= "+H.x+", Y = "+H.y);switch(p.getDrawingMode()){case TGOS.TGOverlayType.ENVELOPE:R=new TGOS.TGFill(p.map,null,p.options.envelopeOptions);break;case TGOS.TGOverlayType.CIRCLE:R=new TGOS.TGFill(p.map,null,p.options.circleOptions)}AttachEvent(V,"mousemove",Ia);AttachEvent(V,"mouseup",Ba)}},La=function(Z){if("tgoverlay"==Z.currentTarget.className&& (util.disableDefault(Z),b(Z),DetachEvent(V,"mousemove",Pa),DetachEvent(V,"mouseup",La),!E)){var ca=Z.clientX;Z=Z.clientY;DEBUG_MODE&&console.log("clickEnd X = "+ca+", Y = "+Z);var na=null,ya=p.getDrawingMode();if(ya==TGOS.TGOverlayType.MARKER||ya==TGOS.TGOverlayType.LABEL)na=n(V),ca-=na.x,Z-=na.y,ca=p.map.getMapBase().ToMapPoint(ca,Z),na=p.snapToGraphics(ca),p.map.getCoordSys()==TGOS.TGCoordSys.EPSG3857&&(ca=TGOS.Geometry.Transform(na,TGOS.GooToWGS84),na=new TGOS.TGPoint(ca.x,ca.y));null!==na&&(DEBUG_MODE&& console.log("Add Point X= "+na.x+", Y = "+na.y),p.addGraphic(na,p.drawingMode))}},Pa=function(Z){util.disableDefault(Z);b(Z);E||(E=!Ha(Z.clientX,Z.clientY,J,C))&&DEBUG_MODE&&console.log("clickMoved.")},Oa=function(Z){"tgoverlay"==Z.currentTarget.className&&(util.disableDefault(Z),J=Z.clientX,C=Z.clientY,E=!1,DEBUG_MODE&&console.log("clickStart : X = "+J+", Y = "+C),AttachEvent(V,"mouseup",La),AttachEvent(V,"mousemove",Pa))},Ha=function(Z,ca,na,ya){var W=!1;Z-1!==na&&Z!==na&&Z+1!==na||ca-1!==ya&&ca!== ya&&ca+1!==ya||(W=!0);return W};this.setDrawingMode=function(Z,ca){var na=this.drawingMode;if(na!=Z){na!=TGOS.TGOverlayType.NONE&&(na==TGOS.TGOverlayType.POLYGON||na==TGOS.TGOverlayType.LINESTRING?p.cancelSegDrawing():na==TGOS.TGOverlayType.EDIT?p.cancelEditingMode():na==TGOS.TGOverlayType.MODIFY&&(ca?p.setModifyMode(TGOS.TGModifyType.CANCEL,!0):p.setModifyMode(TGOS.TGModifyType.CANCEL,!1)));V=this.map.getPanes().graphicLayer;DetachEvent(V,"mousedown",Oa);DetachEvent(V,"mousedown",Ka);DetachEvent(V, "mousedown",pa);DetachEvent(V,"mousemove",ka);DetachEvent(V,"mousedown",Da);DetachEvent(V,"mousemove",za);p.useDefaultControl&&(V.style.cursor="crosshair");this.map.setOverlayForwardEvent(!1);switch(Z){case TGOS.TGOverlayType.ENVELOPE:this.envelopeDblClick?AttachEvent(V,"mousedown",Da):AttachEvent(V,"mousedown",Ka);this.drawingMode=TGOS.TGOverlayType.ENVELOPE;break;case TGOS.TGOverlayType.CIRCLE:this.circleDblClick?AttachEvent(V,"mousedown",Da):AttachEvent(V,"mousedown",Ka);this.drawingMode=TGOS.TGOverlayType.CIRCLE; break;case TGOS.TGOverlayType.POLYGON:AttachEvent(V,"mousedown",pa);this.drawingMode=TGOS.TGOverlayType.POLYGON;break;case TGOS.TGOverlayType.LINESTRING:AttachEvent(V,"mousedown",pa);this.drawingMode=TGOS.TGOverlayType.LINESTRING;break;case TGOS.TGOverlayType.MARKER:AttachEvent(V,"mousedown",Oa);this.drawingMode=TGOS.TGOverlayType.MARKER;break;case TGOS.TGOverlayType.LABEL:AttachEvent(V,"mousedown",Oa);this.drawingMode=TGOS.TGOverlayType.LABEL;break;case TGOS.TGOverlayType.EDIT:p.useDefaultControl&& (this.modifyControl.setVisible(!1),this.drawingControl.setVisible(!0),V.style.cursor="pointer");for(i=0;i=h?n.onreadystatechange=function(){this.readyState&&"loaded"!==this.readyState&&"complete"!==this.readyState||(this.parentNode.removeChild(n),n=void 0)}:n.onload=function(){this.parentNode.removeChild(n);n=void 0};n.onerror=function(){e&&e.call(this);this.parentNode.removeChild(n);n=void 0};TGOS.ajaxCount__++;n.src=a;f[0].appendChild(n)}}})(); TGOS.loadJsonData=function(d,a,b,f,e){var g=document.createElement("script");g.type="text/javascript";document.body.appendChild(g);a=0<=a.indexOf("?")?a+"&keystr="+encodeURIComponent(TGOS.tgHash):a+"?keystr="+encodeURIComponent(TGOS.tgHash);a+="&rn="+Math.floor(1E5*Math.random()+1);g.onreadystatechange=function(){"loaded"==this.readyState&&b.call(this,dataObj)};g.onload=function(){b.call(this,dataObj);g.parentNode.removeChild(g);for(var h in g)delete g[h]};g.onerror=function(){f&&f.call(this)};""== d?g.src=a:(e&&(g.src=d+"?serv="+encodeURIComponent(a)+"&skip=true&hash="+TGOS.tgHash),g.src=d+"?serv="+encodeURIComponent(a))};TGOS.DistrictID={U01COS01_201212A:"S01",U01COS02_201212A:"S02",U01COS03_201212A:"S03",U01COS04_201212A:"S04",U01COS05_201212A:"S05",U01TOS01_201212A:"S06",U01TOS02_201212A:"S07",U01TOS03_201212A:"S08",U01TOS04_201212A:"S09",U01TOS05_201212A:"S10",U01VIS01_201212A:"S11",U01VIS02_201212A:"S12",U01VIS03_201212A:"S13",U01VIS04_201212A:"S14",U01VIS05_201212A:"S15"}; TGOS.TGDistrictStat=function(){this.stat=function(d,a,b,f){var e={getImageUrl:"",district:[]},g="";switch(d){case TGOS.TGStatMapId.COUNTYMAP:g="county";break;case TGOS.TGStatMapId.TOWNMAP:g="town";break;case TGOS.TGStatMapId.VILLAGEMAP:g="village"}var h="string"==typeof b.layer?b.layer:"",l="string"==typeof b.code?b.code:"",n="ei";switch("string"==typeof b.classifyMethod?b.classifyMethod:""){case "EqualInterval":n="ei";break;case "Quantile":n="qt";break;case "StanDevi":n="sd"}var t="number"==typeof b.classes? b.classes.toString():"",k="green";switch(b.graduatedColor.toLowerCase()){case "red":k="red";break;case "yellow":k="yellow";break;case "green":k="green";break;case "blue":k="blue"}var p="number"==typeof b.height?b.height.toString():"",E="number"==typeof b.width?b.width.toString():"";TGOS.getJSON(TGOS.STATISTICS_SERVICE2+"?width="+E+"&height="+p+"&district="+g+"&color="+k+"&layer="+h+"&code="+l+"&method="+n+"&classnum="+t,function(H){if(H&&H.error)f.call(this,null,"REQUEST_DENIED");else{e.district= H.district;e.legend=H.legend;var B=parseFloat(H.envelope.left),G=parseFloat(H.envelope.top),J=parseFloat(H.envelope.right);H=parseFloat(H.envelope.bottom);e.envelope=new TGOS.TGEnvelope(B,G,J,H);B=TGOS.STATISTICS_SERVICE+"?width="+E+"&height="+p+"&district="+g+"&color="+k+"&layer="+h+"&code="+l+"&method="+n+"&classnum="+t;B=0<=B.indexOf("?")?B+"&keystr="+encodeURIComponent(TGOS.tgHash):B+"?keystr="+encodeURIComponent(TGOS.tgHash);e.imageUrl=B;f.call(this,e,"OK");h in TGOS.DistrictID&&TGOS.Log("web", "A05",TGOS.DistrictID[h])}})}}; TGOS.TGLocateService=function(){function d(e,g,h){var l=[];new TGOS.TGTransformation;var n="",t="";switch(h){case "84":t="EPSG:4326";break;case "97_119":t="EPSG:3825";break;default:t="EPSG:3826"}TGOS.getJSON(TGOS.ADDRESSLOCATE_SERVICE+"?oAddress="+e.address+"&oSRS="+t+"&oResultDataType=jsonp&pnum="+parseInt(e.pageNumber),function(k){if(k&&k.Info&&k.Info.length)if(0>=parseInt(k.Info[0].OutTotal))n=TGOS.TGLocatorStatus.ZERO_RESULTS,g.call(this,null,n);else{n=TGOS.TGLocatorStatus.OK;30=E.Table.length)g.call(this,l,TGOS.TGLocatorStatus.ZERO_RESULTS,0,0);else{for(var H=0;Hb.pageNumber?1:parseInt(b.pageNumber); l=TGOS.QUERY_SERVICE+"?op=att&res="+TGOS.MapIdInfo[d].resource;l+="&layer="+TGOS.MapIdInfo[d].layers[a].name;l+="&EXPR="+encodeURIComponent(g);h.fieldAttr=[];h.position=[];TGOS.getJSON(l+("&page="+b),function(k){var p="";if(k&&k.error)e.call(this,null,"REQUEST_DENIED",0,0);else if(k){var E=k.Feature,H=k.items;k=k.pages;for(var B in TGOS.MapIdInfo[d].layers[a].query)p=p+B+",";h.fieldName=p;for(var G=E.length,J=0;J>1):n>>1;n=l=0;do t=d.charCodeAt(f++)-63,n|=(t&31)<>1):n>>1;h.push(e*a);h.push(g*a)}return h};TGOS.TGAddressStatus={ERROR:"ERROR",INVALID_REQUEST:"INVALID_REQUEST",OK:"OK",ZERO_RESULTS:"ZERO_RESULTS"}; TGOS.TGAddress=function(){return function(){this.nearestAddress=function(d,a,b){if(!(d instanceof TGOS.TGPoint))throw"Must be a Point @nearestAddress";var f="EPSG:3826";switch(a){case TGOS.TGCoordSys.EPSG3857:f="EPSG:4326";break;case TGOS.TGCoordSys.EPSG3826:f="EPSG:3826";break;case TGOS.TGCoordSys.EPSG3825:f="EPSG:3825"}TGOS.getJSON(TGOS.ADDRESSLOCATE_SERVICE+"?op=PointQueryNearAddr&oAPPId="+TGOS.APPID+"&oAPIKey="+TGOS.APIKey+"&oSRS="+f+"&oResultDataType=jsonp&oPX="+d.x+"&oPY="+d.y,function(e){e= e.AddressList;0>=e.length?b.call(this,null,TGOS.TGAddressStatus.ZERO_RESULTS):(e=e[0],e={formattedAddress:e.FULL_ADDR,addressComponents:{county:e.COUNTY,town:e.TOWN,village:e.VILLAGE,neighborhood:e.NEIGHBORHOOD,road:e.ROAD,section:e.SECTION,lane:e.LANE,alley:e.ALLEY,sub_alley:e.SUB_ALLEY,tong:e.TONG,number:e.NUMBER},geometry:{bounds:new TGOS.TGEnvelope(e.X,e.Y,e.X,e.Y),location:new TGOS.TGPoint(e.X,e.Y)}},b.call(this,e,TGOS.TGAddressStatus.OK),TGOS.Log("web","A18",""))},null,null)}}}();TGOS.TGMileageType={HIGHWAY:"HIGHWAY",EXPRESSWAY:"EXPRESSWAY",PROVINCEWAY:"PROVINCEWAY",TRA:"TRA",HSR:"HSR"};TGOS.TGDirectionType={N:"N",E:"E",S:"S",W:"W"};TGOS.TGLocatorType={STREET_ADDRESS:"address",INTERPOLATED:"address",ROUTE:"road",COORD:"coord",POI:"poi",INTERSECTION:"roadcross"}; TGOS.COUNTYCODES={"09007":"\u9023\u6c5f\u7e23","09020":"\u91d1\u9580\u7e23",10002:"\u5b9c\u862d\u7e23",10004:"\u65b0\u7af9\u7e23",10005:"\u82d7\u6817\u7e23",10007:"\u5f70\u5316\u7e23",10008:"\u5357\u6295\u7e23",10009:"\u96f2\u6797\u7e23",10010:"\u5609\u7fa9\u7e23",10013:"\u5c4f\u6771\u7e23",10014:"\u81fa\u6771\u7e23",10015:"\u82b1\u84ee\u7e23",10016:"\u6f8e\u6e56\u7e23",10017:"\u57fa\u9686\u5e02",10018:"\u65b0\u7af9\u5e02",10020:"\u5609\u7fa9\u5e02",63E3:"\u81fa\u5317\u5e02",64E3:"\u9ad8\u96c4\u5e02", 65E3:"\u65b0\u5317\u5e02",66E3:"\u81fa\u4e2d\u5e02",67E3:"\u81fa\u5357\u5e02",68E3:"\u6843\u5712\u5e02"}; TGOS.TGLocate=function(){var d=function(e){if(!e)return"";for(var g in TGOS.COUNTYCODES)if(e.replace("\u53f0","\u81fa")==TGOS.COUNTYCODES[g])return g},a=TGOS.LOCATOR_SERVICE,b=getWebProtocal()+getServicePath()+"TGLocator/TGLocator.ashx",f=function(){};f.prototype.buildDescription=function(e,g,h,l){var n="",t="",k="";switch(e){case TGOS.TGMileageType.HIGHWAY:n="\u570b\u9053";break;case TGOS.TGMileageType.EXPRESSWAY:n="\u5feb\u901f\u9053\u8def";break;case TGOS.TGMileageType.PROVINCEWAY:n="\u7701\u9053"; break;case TGOS.TGMileageType.TRA:n="\u53f0\u9435";break;case TGOS.TGMileageType.HSR:n="\u9ad8\u9435"}k=e==TGOS.TGMileageType.HSR?k+n:k+(n+l);if(e==TGOS.TGMileageType.HIGHWAY){switch(g){case TGOS.TGDirectionType.E:t="\u6771\u5411";break;case TGOS.TGDirectionType.W:t="\u897f\u5411";break;case TGOS.TGDirectionType.S:t="\u5357\u5411";break;case TGOS.TGDirectionType.N:t="\u5317\u5411"}k+=","+t}return k+(","+h+"\u516c\u91cc")};f.prototype.calcViewport=function(e,g,h){switch(h){case TGOS.TGCoordSys.EPSG3857:g= TGOS.WGS84ToGoo(e,g);e=TGOS.GooToWGS84(g.x-500,g.y+500);g=TGOS.GooToWGS84(g.x+500,g.y-500);e=new TGOS.TGEnvelope(e.x,e.y,g.x,g.y);break;default:e=new TGOS.TGEnvelope(e-500,g+500,e+500,g-500)}return e};f.prototype.buildGeometry=function(e,g){var h=new TGOS.TGPoint;switch(g){case TGOS.TGCoordSys.EPSG3826:h.x=e.TWD97X||e["97X"];h.y=e.TWD97Y||e["97Y"];break;case TGOS.TGCoordSys.EPSG3857:h.x=e.Lng;h.y=e.Lat;break;case TGOS.TGCoordSys.EPSG3825:x97=e.TWD97X||e["97X"],y97=e.TWD97Y||e["97Y"],e=TGOS.TWD97toTWD97_119(x97, y97),h.x=e.x,h.y=e.y}g=this.calcViewport(h.x,h.y,g);return{location:h,bounds:new TGOS.TGEnvelope(h.x,h.y,h.x,h.y),viewport:g}};f.prototype.complexLocate=function(e,g,h){var l=this,n=e.requestText,t=e.town,k=e.county,p=e.geometryInfo,E=e.pageNumber;e=e.center;switch(g){case TGOS.TGCoordSys.EPSG3826:var H="EPSG:3826";break;case TGOS.TGCoordSys.EPSG3857:H="EPSG:4326"}n=b+"?format=jsonp&input="+n+"&srs="+H;k&&(n+="&county="+k);t&&(n+="&town="+t);n+=p?"&ignoreGeometry=false":"&ignoreGeometry=true";"number"== typeof E&&(n+="&pnum="+E);e instanceof TGOS.TGPoint&&!isNaN(e.x)&&!isNaN(e.y)&&(n+="¢er="+e.x+","+e.y);TGOS.getJSON(n,function(B){var G=B.status,J=B.results,C=B.featureCount,L=B.pages,I=[];if("OK"==G||"TOO_MANY_RESULTS"==G)for(var Q=0;Q= E.Table.length){var H=TGOS.TGLocatorStatus.ZERO_RESULTS;h.call(l,null,null,H)}else H=l.buildDescription(n,k,p,E.Table[0].Number),E=l.buildGeometry(E.Table[0],g),h&&h.call(l,H,E,"OK"),TGOS.Log("web","A17","");else H=TGOS.TGLocatorStatus.ERROR,h.call(l,null,null,H)})};return f}();(function(){var d=["Document","Folder","Placemark"];TGOS.TGKmlLayerOption=function(){this.suppressInfoWindows=this.preserveViewport=this.map=null;this.markerFitImageSize=!1};TGOS.TGKmlLayerMetaData=function(){this.snippet=this.name=this.description=this.author=null};TGOS.KmlMouseEvent=function(){this.pixelOffset=this.point=this.feature=null};TGOS.KmlFeatureData=function(){this.snippet=this.name=this.description=this.author=null};TGOS.KmlAuthor=function(){this.uri=this.name=this.email=null};TGOS.TGKmlLayerStatus= {DOCUMENT_NOT_FOUND:"DOCUMENT_NOT_FOUND",DOCUMENT_TOO_LARGE:"DOCUMENT_TOO_LARGE",FETCH_ERROR:"FETCH_ERROR",INVALID_DOCUMENT:"INVALID_DOCUMENT",INVALID_REQUEST:"INVALID_REQUEST",LIMITS_EXCEEDED:"LIMITS_EXCEEDED",OK:"OK",TIMED_OUT:"TIMED_OUT",UNKNOWN:"UNKNOWN"};TGOS.TGKmlLayer=function(a,b,f){var e=this,g=b.map,h=!1,l,n="auto",t=!0;b&&(void 0!==b.zIndex&&"number"==typeof b.zIndex&&(n=b.zIndex),void 0!==b.visible&&"boolean"==typeof b.visible&&(t=b.visible),void 0!==b.independentContainer&&"boolean"== typeof b.independentContainer&&(h=b.independentContainer,1==h&&(l=g.addIndependentContainer("KML",this))));var k=g.getCoordSys(),p={author:{email:"",name:"",uri:""},description:"",name:"",snippet:""},E=new TGOS.TGInfoWindow("",null,{pixelOffset:new TGOS.TGSize(0,0)}),H=null,B=b.markerFitImageSize;this.overlays=[];this.points=[];this.polygons=[];this.polylines=[];this.groundoverlays=[];this.icons=[];this.getDefaultViewport=function(){if(!H){for(var M=Infinity,q=-Infinity,m=-Infinity,F=Infinity,z=0;z< this.overlays.length;z++){var D=this.overlays[z].getBounds();M=Math.min(M,D.left);F=Math.min(F,D.bottom);q=Math.max(q,D.right);m=Math.max(m,D.top)}for(z=0;zq.length))return q[0]};this.parseRing=function(M,q){switch(q){case "EPSG3826":var m=this.parseCoordinates(M.coordinates,"EPSG3826");break;case "EPSG3825":m=this.parseCoordinates(M.coordinates,"EPSG3825");break;case "EPSG3857":m=this.parseCoordinates(M.coordinates,"EPSG3857")}M=new TGOS.TGLineString(m);return new TGOS.TGLinearRing(M)};this.createPolygon=function(M){var q=[], m=this.parseRing(M.outerBoundaryIs.LinearRing,k);q.push(m);var F=M.innerBoundaryIs;if(F)if(F.length)for(var z=0;zM.r&&(q="0"+ q);var m=M.g.toString(16);16>M.g&&(m="0"+m);var F=M.b.toString(16);16>M.b&&(F="0"+F);return"#"+q+m+F}};this.handlePlacemark=function(M,q){var m=[];if(M.length)for(var F=0;F");0";for(q=0;q";F+="";F+="";F+=""}F+="
";F+=u||m;F+="";F+=w;F+="
"}if(z.SchemaData)for(z=z.SchemaData.length?z.SchemaData:[z.SchemaData],D=0;D";for(q=0;q",F+="",F+="",F+="";F+="
",F+=A+":"+m,F+="",F+=void 0===w?"":w,F+="
"}}}0D&&A.substr(0,D)==z){var K=F[A];void 0!==K&&q(K,z);delete F[A];A=A.replace(z,"");F[A]=K}}}if(!M||M.error)Y=TGOS.TGKmlLayerStatus.FETCH_ERROR,"function"==typeof f&&f.call(this,Y);else{var m=M.kml;void 0==m&&(m=M["kml:kml"],void 0!==m&&q(m,"kml:"));m.Document?(m.Document.hasOwnProperty("description")&&null!=m.Document.description&&(m.Document.description.hasOwnProperty("#cdata-section")? p.description=m.Document.description["#cdata-section"]:p.description=m.Document.description),m.Document.hasOwnProperty("name")&&null!=m.Document.name&&(m.Document.name.hasOwnProperty("#cdata-section")?p.name=m.Document.name["#cdata-section"]:p.name=m.Document.name),m.Document.hasOwnProperty("Snippet")&&null!=m.Document.Snippet&&(m.Document.Snippet.hasOwnProperty("#cdata-section")?p.snippet=m.Document.Snippet["#cdata-section"]:p.snippet=m.Document.Snippet),m.Document.hasOwnProperty("atom:author")&& e.handleAuthor(m.Document["atom:author"]),e.Schema=m.Document.Schema):(m.hasOwnProperty("description")&&null!=m.description&&(m.description.hasOwnProperty("#cdata-section")?p.description=m.description["#cdata-section"]:p.description=m.description),m.hasOwnProperty("name")&&null!=m.name&&(m.name.hasOwnProperty("#cdata-section")?p.name=m.name["#cdata-section"]:p.name=m.name),m.hasOwnProperty("Snippet")&&null!=m.Snippet&&(m.Snippet.hasOwnProperty("#cdata-section")?p.snippet=m.Snippet["#cdata-section"]: p.snippet=m.Snippet),m.hasOwnProperty("atom:author")&&e.handleAuthor(m["atom:author"]));e.parseKML(M.kml);Y=TGOS.TGKmlLayerStatus.OK;b&&1==b.preserveViewport&&(M=e.getDefaultViewport())&&g.fitBounds(M);"function"==typeof f&&f.call(e,e,Y)}},TGOS.PROXY_SERVICE2,function(){"function"==typeof f&&f.call(this,TGOS.TGKmlLayerStatus.FETCH_ERROR)});this.removeAdvancedLayer=function(){null!=l&&(g.removeIndependentContainer(l),g.removeAdvancedLayer(this),l=null,h=!1)};this.moveToTop=function(){null!=l&&g.moveIndependentContainerToTop(l)}; this.getNode=function(){if(g)return 1==h&&null!=l?[l.div.main,l.div.shadow]:g.getPanes().graphicLayer}};TGOS.RegisterEvent(TGOS.TGKmlLayer,"click mousemove mouseout mouseover dblclick rightclick".split(" "))})();TGOS.TGWmtsLayer=function(){var d=function(a){this.fitBound=a.fitBound;this.matrixSet=a.matrixSet;this.matrixId=a.matrixId;this.row=a.row;this.col=a.col;this.left=a.left;this.top=a.top;this.right=a.right;this.bottom=a.bottom;this.scaledWidth=a.scaledWidth;this.scaledHeight=a.scaledHeight;this.toString=function(){return"{"+this.matrixId+","+this.row+","+this.col+"}"}};d.prototype.equals=function(a){return this.matrixId==a.matrixId&&this.row==a.row&&this.col==a.col};return function(a,b,f,e,g){this.layers= [];this.tileMatrixSets=[];var h=null;b&&(h=b.getPanes().overlayviewLayer);var l=null,n=!1,t=name,k=!0,p=1,E,H=null,B=null,G=null,J=null,C=null,L=null;void 0!==e&&null!==e&&(null!=e.container&&(h=e.container),null!=e.fitDiv&&(fitDiv=e.fitDiv),H="number"==typeof e.left?e.left:null,B="number"==typeof e.top?e.top:null,G="number"==typeof e.right?e.right:null,J="number"==typeof e.bottom?e.bottom:null,p="number"==typeof e.opacity?Math.max(0,Math.min(1,e.opacity)):1,k=0==e.wmtsVisible?!1:!0);var I=[];n=!1; var Q=this,U=2.8E-4,V=256;void 0!==f&&(U="number"==typeof f.dpi?25.4/f.dpi/1E3:2.8E-4,V="number"==typeof f.tileWidth?f.tileWidth:256);var O="number"==typeof e.zIndex?e.zIndex:"auto";L=null;var Y=function(w){var u=document.createElement("div");u.className="TGOS_WMTS";u.style.position="absolute";u.style.left="0px";u.style.top="0px";u.style.width="100%";u.style.height="100%";u.style.zIndex=O;u.style.display=k?"":"none";w.appendChild(u);return u}(h);document.createElement("img");this.moveToTop=function(){h&& (h.removeChild(Y),h.appendChild(Y))};this.moveLayerTo=function(w){if(h&&Y){var u=h.childNodes.length,A=null;w&&(0>w?A=h.firstChild:w>=u||(A=h.childNodes[w]));h.removeChild(Y);A?h.insertBefore(Y,A):h.appendChild(Y)}};this.getNode=function(){return Y};this.getLayerId=function(){return t};this.getMatrixSetId=function(){return L["ows:Identifier"]};this.getTileOpacity=function(){return p};this.setTileOpacity=function(w){"number"==typeof w&&(p=w,Y&&(Y.style.opacity=p,Y.style.filter="alpha(opacity="+100* p+")"))};this.getSource=function(){return a};this.setZIndex=function(w){O=w;Y&&(Y.style.zIndex=O)};this.getZIndex=function(){return O};this.RemoveSelf=function(){h.removeChild(Y)};var M=function(){var w=this,u=0;w.style.opacity=u;var A=p/7,K=setInterval(function(){u>=p?(w.style.filter="alpha(opacity="+100*p+")",w.style.opacity=p,clearInterval(K)):(w.style.opacity=u,w.style.filter="alpha(opacity="+100*u+")",u+=A)},33);w.style.filter="alpha(opacity=0)";w.style.display="block"},q=function(w,u,A,K){if(!w)return null; if(w.TileMatrix.length||w.TileMatrix["ows:Identifier"]!=u)for(var S=0;S=aa?0:Math.floor((aa-da)/pa);ka=ea+Math.ceil(Math.abs(ka-da)/pa)+1;da=1;K&&(da=parseFloat(R.ScaleDenominator)*U/(.0254*K/96));fa-=sa;var qa=ka-ea;K=[];var za=Infinity,Da=-Infinity;var Ba=Infinity;var Ia=-Infinity,Ka=0,La=0,Pa=[0,-1];for(ka=Math.pow(Math.max(fa,qa),2);0Da&&(Da=Ka),LaIa&&(Ia=La));if(Ka===La||0>Ka&&Ka===-La||0B&&(w.top=B);null!==G&&w.right>G&&(w.right=G);null!==J&&w.bottomE.maxZoom||B==d){E.clearClusters();for(B=0;BE.maxZoom){E.clearClusters();for(B=0;Bthis.maxZoom||t==d){this.clearClusters();for(t=0;tthis.maxZoom){this.clearClusters();for(t=0;tthis.maxZoom||t==d){this.clearClusters();return}}else if(t>this.maxZoom){this.clearClusters(); return}t=this.getExtendedBounds();for(var k=0;k=this.clusters[t].symbols.length&&this.addClusterMarker(this.clusters[t])}};n.addClusterMarker=function(t){var k= t.centerLonLat?t.centerLonLat:t.center;var p=new TGOS.TGPoint(k.x,k.y);k=t.markers.length;var E=new TGOS.TGMarker(null,p);E.setFlat(!0);E.setClickable(!0);E.setVisible(this.visible);E.setZIndex(this.zIndex);E.setMap(this.map);t.symbols.push(E);if(1B.length-1?B[B.length-1]:B[G];t.symbols[0].setIcon(p.icon);t.symbols[0].setTitle(t.markers.length);t.symbols[1].setFontColor(p.labelColor?p.labelColor:"#f0f0f0");t.symbols[1].setFontSize(p.labelSize?p.labelSize:12);p.labelAnchor&&t.symbols[1].setOffset(p.labelAnchor);break a}p=B[B.length-1];t.symbols[0].setIcon(p.icon);t.symbols[0].setTitle(t.markers.length); t.symbols[1].setFontColor(p.labelColor?p.labelColor:"#f0f0f0");t.symbols[1].setFontSize(p.labelSize?p.labelSize:12);p.labelAnchor&&t.symbols[1].setOffset(p.labelAnchor)}}1==k&&(TGOS.TGEvent.copyEvent(t.markers[0],E),E.setTitle(t.markers[0].getTitle()),E.annotation=t.markers[0].annotation);H&&(H.cluster=t,TGOS.TGEvent.addListener(H,"click",this.clickHandler));E&&(E.cluster=t,TGOS.TGEvent.addListener(E,"click",this.clickHandler))};n.getScaleClass=function(){return this.scaleClass};n.setScaleClass=function(t){this.scaleClass= t};n.setClusterStyle=function(t){this.styles=t};n.getClusterStyle=function(){return this.styles};n.removeMarker=function(t,k){for(var p=0;pH?2*H*H:-1+(4-2*H)*H;pn?0:n>=h?h:n;var k=0>g?0:g>l?l:g;l=0>t?0:t>=l?l:t;t=-Infinity;var p=Infinity;for(h=0>e?0:e>h?h:e;hthis.maxIntensity&&(f[h][E]=maxIntensity),t=Math.max(t,f[h][E]),p=Math.min(p,f[h][E]);return{max:t,min:p}};TGOS.TGHeatmapLayer=function(f){this.data=[];this.div=document.createElement("div");this.div.style.width="100%";this.div.style.height= "100%";this.div.style.position="absolute";this.cv=document.createElement("canvas");this.cv.style.position="absolute";this.div.appendChild(this.cv);this.ctx=this.cv.getContext("2d");this.cacheImage=new Image;f&&this.setOptions(f)};TGOS.TGHeatmapLayer.prototype=new TGOS.TGOverlayView;a=TGOS.TGHeatmapLayer.prototype;a.getData=function(){return this.data};a.createKernels=function(){this.kernels=[];for(var f=0;ft.height-3&&(k=t.height-3);a.top=k}else k=n.clientX-t.left,k>t.width-3&&(k=t.width-3),a.left=k;a.updateClip_();n.preventDefault&&n.preventDefault();return!1}};AttachEvent(f,"mousedown",b)}else if("circle"==this.type||"square"==this.type||"round"==this.type)this.node.style.width=this.swipeSize+"px",this.node.style.height=this.swipeSize+"px",this.node.style.position="absolute",this.top=this.top/2-this.swipeSize/ 2,this.left-=this.swipeSize/2,this.node.style.left=this.left+"px",this.node.style.top=this.top+"px","square"==this.type?(this.node.style.borderStyle=this.borderStyle,this.node.style.borderWidth=this.borderWidth+"px",this.node.style.borderColor=this.borderColor):"circle"==this.type?(this.node.style.borderStyle=this.borderStyle,this.node.style.borderWidth=this.borderWidth+"px",this.node.style.borderRadius="50%",this.node.style.borderColor=this.borderColor,this.bounds_changed_=TGOS.TGEvent.addListener(this.map, "bounds_changed",function(){a.mapChanged(a)}),this.zoom_changed_=TGOS.TGEvent.addListener(this.map,"zoom_changed",function(){a.mapChanged(a)}),this.tilesloaded_=TGOS.TGEvent.addListener(this.map,"tilesloaded",function(){a.mapChanged(a)}),this.drag_=TGOS.TGEvent.addListener(this.map,"drag",function(){a.mapChanged(a)})):"round"==this.type&&(this.node.style.borderStyle=this.borderStyle,this.node.style.borderWidth=this.borderWidth,this.node.style.borderRadius=this.borderRadius,this.node.style.borderColor= this.borderColor,this.bounds_changed_=TGOS.TGEvent.addListener(this.map,"bounds_changed",function(){a.mapChanged(a)}),this.zoom_changed_=TGOS.TGEvent.addListener(this.map,"zoom_changed",function(){a.mapChanged(a)}),this.tilesloaded_=TGOS.TGEvent.addListener(this.map,"tilesloaded",function(){a.mapChanged(a)}),this.drag_=TGOS.TGEvent.addListener(this.map,"drag",function(){a.mapChanged(a)})),b=function(n){AttachEvent(document.body,"mousemove",l);AttachEvent(document.body,"mouseup",h);a.clientX=n.clientX; a.clientY=n.clientY;n.preventDefault&&n.preventDefault();return!1},h=function(n){DetachEvent(document.body,"mousemove",l);DetachEvent(document.body,"mouseup",h);n.preventDefault&&n.preventDefault();return!1},l=function(n){if(a.node&&a.node.parentNode){var t=a.left+(n.clientX-a.clientX),k=a.top+(n.clientY-a.clientY),p=a.node.parentNode.getBoundingClientRect();k>p.height-10&&(k=p.height-10);k<-a.swipeSize+10&&(k=-a.swipeSize+10);t>p.width-10&&(t=p.width-10);t<-a.swipeSize+10&&(t=-a.swipeSize+10);a.node.style.top= k+"px";a.top=k;a.clientY=n.clientY;a.node.style.left=t+"px";a.left=t;a.clientX=n.clientX;a.updateClip_();n.preventDefault&&n.preventDefault();return!1}},AttachEvent(this.node,"mousedown",b)};d.wmtsRefreshed=function(a){a.mapChanged(a)};d.wmsRefreshed=function(a){a.mapChanged(a)};d.mapChanged=function(a){function b(){clearTimeout(f);e=a.updateClip_(e);0a?a:bf.attributes[this.attributeField]&&this.infos[e].minValue<= f.attributes[this.attributeField])return this.infos[e].symbol;return this.defaultSymbol};this.infos=[];if(!a)throw"Default Symbol must be provided";this.defaultSymbol=a;if("string"!=typeof b)throw"Attribute field must be provided";this.attributeField=b}};TGOS.extend(d.Renderer,d.ClassBreaksRenderer);d.ClassBreaksRenderer.prototype.addBreak=function(a){this.infos.push(a)};d.ClassBreaksRenderer.prototype.removeBreak=function(a){a=this.infos.indexOf(a);0<=a&&this.infos.splice(a,1)};return d}();TGOS.request=function(){var d={},a=0,b=function(g){var h=document.createElement("form");h.setAttribute("method",g.method?g.method:"POST");h.setAttribute("enctype","multipart/form-data");h.setAttribute("encoding","multipart/form-data");for(var l in g.data){var n=document.createElement("input");n.type="hidden";n.name=l;n.value=g.data[l];h.appendChild(n)}g=document.createElement("input");g.type="submit";h.appendChild(g);document.body.appendChild(h);return h};d.iframe=function(g,h){var l="sgIFrame"+a, n=document.createElement("iframe");n.setAttribute("id",l);n.setAttribute("name",l);n.setAttribute("width","0");n.setAttribute("height","0");n.setAttribute("border","0");n.setAttribute("style","width: 0; height: 0; border: none;");var t=h.form?h.form:b(h);document.body.appendChild(n);var k=document.getElementById(l),p=function(){k.detachEvent?k.detachEvent("onload",p):k.removeEventListener("load",p,!1);k.contentDocument?content=k.contentDocument.body.innerHTML:k.contentWindow?content=k.contentWindow.document.body.innerHTML: k.document&&(content=k.document.body.innerHTML);h.callback&&h.callback.call(this,JSON.parse(content));k.parentNode.removeChild(k)};k.addEventListener&&k.addEventListener("load",p,!0);k.attachEvent&&k.attachEvent("onload",p);t.setAttribute("target",l);t.setAttribute("action",g);t.submit();a++};var f=function(g,h,l){return 0<=g.indexOf("?")?g+"&"+h+"="+l:g+"?"+h+"="+l};d.getJSON=function(g,h,l,n){var t=DeviceTest();"number"!=typeof d.ajaxCount__&&(d.ajaxCount__=0);var k="sn"+d.ajaxCount__;TGOS.request.getJSON[k]= function(){h.apply(this,arguments);delete TGOS.request.getJSON[k]};l&&(g=f(l,"serv",encodeURIComponent(g)));g=f(g,"jsonp",encodeURIComponent("TGOS.request.getJSON['"+k+"']"));l=document.getElementsByTagName("head");if(0!=l.length){var p=document.createElement("script");p.type="text/javascript";"MSIE"==t?p.onreadystatechange=function(){this.readyState&&"loaded"!==this.readyState&&"complete"!==this.readyState||(this.parentNode.removeChild(p),p=void 0)}:p.onload=function(){this.parentNode.removeChild(p); p=void 0};p.onerror=function(){n&&n.call(this);this.parentNode.removeChild(p);p=void 0};d.ajaxCount__++;p.src=g;l[0].appendChild(p)}};var e=function(g,h,l){4==g.readyState&&(200!=g.status&&304!=g.status?l&&l.call(this,g.status):h&&h.call(this,g))};d.ajax=function(g,h){var l=window.XMLHttpRequest?new XMLHttpRequest:window.ActiveXObject?new ActiveXObject("Microsoft.XMLHTTP"):void 0;var n="get",t=!1,k=null,p=null,E=null,H=null,B=null;h&&("post"===h.method&&(n="post"),!1===h.async&&(t=!1),!1===h.async&& (k=null),h.user&&(p=h.user),h.password&&(E=h.password),h.error&&(H=h.error),h.complete&&(B=h.complete));l.open(n,g,t,p,E);k&&l.setRequestHeader("Content-type","application/x-www-form-urlencoded");!0===t&&(l.onreadystatechange=function(G){e(l,B,H)});4!=l.readyState&&(l.send(k),!1===t&&e(l,B,H))};d.get=function(g,h){h.method="get";d.ajax.call(this,g,h)};d.post=function(g,h){h.method="post";d.ajax.call(this,g,h)};return d}();(function(){var d=/\${[\w:]*}/g,a;TGOS.GraphicsLayer=function(){this.graphics=this.surface=this.lastScale=this.svgContainer=this.surface_=this.map_=null;this.mouseEventEnabled=!0;this.infoTemplate=this.renderer=null;this.visible=!0;this.graphics=[];this.title=this.name="Graphics Layer";this.maxScale=this.minScale=0;this.getNode=function(){return this.node};this.templateReplace=function(b,f){var e=f.match(d);if(e)for(var g=0;g=h.length?l=b.attributes[h[0]]?b.attributes[h[0]]:"":window[h[1]]&&(l=window[h[1]].call(this,b.attributes[h[0]],h[0],b.attributes));f=f.replace(e[g],l)}return f};this.add=function(b){b&&(b.layer=this,b.draw(this.map_,new TGOS.TGPoint(b.attributes.longitude,b.attributes.latitude)),this.graphics.push(b),TGOS.TGEvent.trigger(b,"graphic-add"))};this.clear=function(){for(var b=0;bthis.minScale)&&f};this.setMaxScale=function(b){"number"==typeof b&&(this.maxScale=b,this.map_&&(b=this.map_.getMapBase().getScale(), this.isVisibleAtScale(b)||(this.node.style.visibility="hidden")))};this.setMinScale=function(b){"number"==typeof b&&(this.minScale=b,this.map_&&(b=this.map_.getMapBase().getScale(),this.isVisibleAtScale(b)||(this.node.style.visibility="hidden")))};this.setVisibility=function(b){"boolean"==typeof b&&(this.node&&(this.node.style.visibility=b?"visible":"hidden"),this.visible=b)};this.setRenderer=function(b){this.renderer=b;this.map_&&this.redraw()};this.redraw=function(){for(var b=0;bthis.opacity&&(this.opacity=0),1=b.length)return!1;var p=e;if(1==n)for(;ef&&(f=0);f>this.maxDataValue&&(f=this.maxDataValue);if(this.ColorArry){var e=this.CompareValue(b);this.color=e?e:"#88ff33"}else.33>=b/this.maxDataValue? this.color=this.lowColor:.66>=b/this.maxDataValue?this.color=this.midColor:1>=b/this.maxDataValue&&(this.color=this.highColor);var g=this.angle,h=180*(1-f/this.maxDataValue),l=h-g;this.animation&&this.animation.stop();this.valueSpan.style.left=this.cx-this.valueSpan.clientWidth/2+"px";this.valueSpan.style.top=this.cy+"px";this.valueSpan.innerHTML=b+" "+this.unitLabel;isNaN(f)?(b=a.createPathStr(180,a.outRadius,a.inRadius,a.cx,a.cy),a.path.attr({path:b}),this.angle=180):(this.animation=TGOS.fx.createAnimation({easing:TGOS.fx.easing.quadInOut, type:window.requestAnimationFrame?"":"setTimeout",duration:150,onAnimation:function(n){a.angle=g+l*n;n=a.createPathStr(a.angle,a.outRadius,a.inRadius,a.cx,a.cy);a.path.attr({fill:a.color});a.path.attr({path:n})},onEnd:function(){var n=a.createPathStr(h,a.outRadius,a.inRadius,a.cx,a.cy);a.path.attr({path:n})}}),this.animation.play())}};d.setCaption=function(a){"string"==typeof a&&(this.caption=a,this.captionSpan&&(this.captionSpan.innerHTML=a))};d.setTitle=function(a){"string"==typeof a&&(this.title= a,this.titleSpan&&(this.titleSpan.innerHTML=a))};d.setLabel=function(a){"string"==typeof a&&(this.label=a,this.labelSpan&&(this.labelSpan.innerHTML=a))};d.setValue=function(a){"number"==typeof a&&(this.value=a,this.valueSpan&&(this.valueSpan.innerHTML=a,this.valueSpan.style.left=this.cx-this.valueSpan.clientWidth/2+"px",this.valueSpan.style.top=this.cy))};d.setFeature=function(a){a instanceof TGOS.Graphic&&(this.feature=a,this.update())};d.startup=function(){for(var a=this,b=0;b=f.MinValue&&aF.length))return F[0]};this.parseRing=function(m,F){switch(F){case "EPSG3826":var z=this.parseCoordinates(m.coordinates,"EPSG3826");break;case "EPSG3825":z=this.parseCoordinates(m.coordinates,"EPSG3825");break;case "EPSG3857":z=this.parseCoordinates(m.coordinates,"EPSG3857")}m=new TGOS.TGLineString(z);return new TGOS.TGLinearRing(m)};this.createPolygon= function(m){var F=[],z=this.parseRing(m.outerBoundaryIs.LinearRing,H);F.push(z);var D=m.innerBoundaryIs;if(D)if(D.length)for(var w=0;wm.r&&(F="0"+F);var z=m.g.toString(16);16>m.g&&(z="0"+z);var D=m.b.toString(16);16>m.b&&(D="0"+D);return"#"+F+z+D}};this.handlePlacemark=function(m,F){var z=[];if(m.length)for(var D=0;D");0";for(F=0;F";D+="";D+="";D+=""}D+= "
";D+=K||z;D+="";D+=A;D+="
"}if(w.SchemaData)for(w=w.SchemaData.length?w.SchemaData:[w.SchemaData],u=0;u";for(F=0;F",D+="",D+="",D+="";D+="
", D+=S+":"+z,D+="",D+=void 0===A?"":A,D+="
"}}}0u&&S.substr(0,u)==w){var R=D[S];void 0!==R&&F(R,w);delete D[S];S=S.replace(w,"");D[S]=R}}}if(!m||m.error)q=TGOS.TGKmlLayerStatus.FETCH_ERROR, "function"==typeof h&&h.call(this,q);else{var z=m.kml;void 0==z&&(z=m["kml:kml"],void 0!==z&&F(z,"kml:"));z.Document?(z.Document.hasOwnProperty("description")&&null!=z.Document.description&&(z.Document.description.hasOwnProperty("#cdata-section")?B.description=z.Document.description["#cdata-section"]:B.description=z.Document.description),z.Document.hasOwnProperty("name")&&null!=z.Document.name&&(z.Document.name.hasOwnProperty("#cdata-section")?B.name=z.Document.name["#cdata-section"]:B.name=z.Document.name), z.Document.hasOwnProperty("Snippet")&&null!=z.Document.Snippet&&(z.Document.Snippet.hasOwnProperty("#cdata-section")?B.snippet=z.Document.Snippet["#cdata-section"]:B.snippet=z.Document.Snippet),z.Document.hasOwnProperty("atom:author")&&l.handleAuthor(z.Document["atom:author"]),l.Schema=z.Document.Schema):(z.hasOwnProperty("description")&&null!=z.description&&(z.description.hasOwnProperty("#cdata-section")?B.description=z.description["#cdata-section"]:B.description=z.description),z.hasOwnProperty("name")&& null!=z.name&&(z.name.hasOwnProperty("#cdata-section")?B.name=z.name["#cdata-section"]:B.name=z.name),z.hasOwnProperty("Snippet")&&null!=z.Snippet&&(z.Snippet.hasOwnProperty("#cdata-section")?B.snippet=z.Snippet["#cdata-section"]:B.snippet=z.Snippet),z.hasOwnProperty("atom:author")&&l.handleAuthor(z["atom:author"]));l.parseKML(z);q=TGOS.TGKmlLayerStatus.OK;g&&1==g.preserveViewport&&(m=l.getDefaultViewport())&&n.fitBounds(m);"function"==typeof h&&h.call(l,q)}},f,function(){"function"==typeof h&&h.call(this, TGOS.TGKmlLayerStatus.FETCH_ERROR)});this.removeAdvancedLayer=function(){null!=k&&(n.removeIndependentContainer(k),n.removeAdvancedLayer(this),k=null,t=!1)};this.moveToTop=function(){null!=k&&n.moveIndependentContainerToTop(k)};this.getNode=function(){if(n)return 1==t&&null!=k?[k.div.main,k.div.shadow]:n.getPanes().graphicLayer}};TGOS.RegisterEvent(TGOS.KMLLayer,"click mousemove mouseout mouseover dblclick rightclick".split(" "))})();TGOS=TGOS||{}; (function(){var d=function(a){this.left=a.left;this.top=a.top;this.right=a.right;this.bottom=a.bottom;this.src=a.src;this.width=a.width;this.height=a.height;this.layer=a.layer;this.cancel=this.loaded=!1;this.node=document.createElement("img");this.node.style.position="absolute";this.setSource=function(f){this.loaded=!1;this.node.src=f};var b=this;this.node.onload=function(){b.cancel?b.loaded=!1:(b.loaded=!0,a.onload&&a.onload.call(b))};this.src&&(this.node.src=this.src);"number"==typeof this.width&&(this.node.width= this.width);"number"==typeof this.height&&(this.node.height=this.height);this.destroy=function(){this.node&&this.node.parentNode&&this.node.parentNode.removeChild(this.node)}};TGOS.WMSLayer=function(a,b,f,e,g,h){function l(){if(t){var D=F.getClientWidth(),w=F.getClientHeight(),u=F.ToMapPoint(0,0),A=F.ToMapPoint(D,w);n();var K=null!=G?G+"="+L:"1.3.0"==C?"CRS="+L:"SRS="+L;switch(t.getCoordSys()){case TGOS.TGCoordSys.EPSG3857:u=TGOS.GooToWGS84(u.x,u.y);A=TGOS.GooToWGS84(A.x,A.y);break;case TGOS.TGCoordSys.EPSG3826:0> L.indexOf("3826")&&(0<=L.indexOf("3825")?(u=TGOS.TWD97toTWD97_119(u.x,u.y),A=TGOS.TWD97toTWD97_119(A.x,A.y)):0<=L.indexOf("4326")&&(u=TGOS.TWD97toWGS84(u.x,u.y),A=TGOS.TWD97toWGS84(A.x,A.y)));break;case TGOS.TGCoordSys.EPSG3825:0>L.indexOf("3825")&&(0<=L.indexOf("3826")?(u=TGOS.TWD97_119toTWD97(u.x,u.y),A=TGOS.TWD97_119toTWD97(A.x,A.y)):0<=L.indexOf("4326")&&(u=TGOS.TWD97_119toWGS84(u.x,u.y),A=TGOS.TWD97_119toWGS84(A.x,A.y)))}var S=u.x,R=A.y,aa=A.x,ea=u.y;"1.3.0"==C&&0>L.indexOf("CRS:84")&&0<=L.indexOf("EPSG:4326")&& (S=A.y,R=u.x,aa=u.y,ea=A.x);D=z+"?BBOX="+(S+","+R+","+aa+","+ea)+"&WIDTH="+D+"&HEIGHT="+w;D+="&"+O.join("&");D+="&"+K;p&&(D=p+"?"+D);return D}}function n(){if(t){var D=F.getClientWidth(),w=F.getClientHeight(),u=F.ToMapPoint(0,0),A=F.ToMapPoint(D,w);return{left:u.x,top:u.y,right:A.x,bottom:A.y,width:D,height:w}}}var t=f,k=!0,p,E="auto",H,B=1,G=null,J=f.getPanes().overlayviewLayer;g&&(void 0!==g.opacity&&"number"==typeof g.opacity&&(B=g.opacity),void 0!==g.visible&&"boolean"==typeof g.visible&&(k=g.visible), void 0!==g.container&&(J=g.container),void 0!==g.proxy&&(p=0=D?u=J.firstChild:D>=w||(u=J.childNodes[D]);J.removeChild(layerContainer);u?J.insertBefore(layerContainer,u):J.appendChild(layerContainer)}}};this.RemoveSelf=function(){J&&m&&J.removeChild(m)}; this.getLayerId=function(){return a};this.getNode=function(){return m};this.getDefaultViewport=function(){};this.getUrl=function(){return z};this.removeLayer=function(){t.removeLayer(this)};this.getZIndex=function(){return E};this.setZIndex=function(D){E=D;m&&(m.style.zIndex=E)};this.getVisible=function(){return k};this.setVisible=function(D){k=D;m&&(m.style.display=k?"block":"none")};this.putVisible=function(D){this.setVisible(D)};this.setProxy=function(D){D&&(p=0>>0;if("function"!==typeof a)throw new TypeError("predicate must be a function");for(var g=0;g>>0;b>>=0;b=0>b?Math.max(g+b,0):Math.min(b,g);f=void 0===f?g:f>>0;for(g=0>f?Math.max(g+f,0):Math.min(f,g);b=this.length?null:this.find(u)||this[0]}function t(){return!this||0>=this.length?null:this[this.push(this.shift())-1]}function k(u){if(!q)return null;var A=l(q.TileMatrix,null);if(!A||0>=A.length)return null;var K=u.ToMapDistX(1)/ (.0254/e.dpi);return(u=A.map(function(S){return{m:S,d:Math.abs(Math.log(parseFloat(S.ScaleDenominator)/K))}}).reduce(function(S,R){return S&&S.d=G.childNodes.length||(u=parseInt(u),isNaN(u)||(0>u&&(u+=G.childNodes.length+1),G.insertBefore(D,u=R?ea=B.firstChild:R>=aa||(ea=B.childNodes[R]);B.removeChild(w);ea?B.insertBefore(w,ea):B.appendChild(w)}}}; this.getLayerId=function(){return f};this.getOpacity=function(){return L};this.setOpacity=function(R){"number"==typeof R&&(L=R,w&&(w.style.opacity=L,w.style.filter="alpha(opacity="+100*L+")"))};this.getZIndex=function(){return I};this.setZIndex=function(R){I=R;w&&(w.style.zIndex=I)};this.getSourceUrl=function(){return e};this.getNode=function(){return w};this.RemoveSelf=function(){B&&w&&B.removeChild(w)};var u=function(R,aa,ea,da){return R.replace(t,da).replace(k,ea).replace(p,aa.z)},A=function(R, aa,ea){if(!R)return null;for(var da,fa=0;faOa&&(Oa=Wa),SaVa&&(Va=Sa));if(Wa===Sa||0>Wa&&Wa===-Sa||0=R?0:Math.floor((R-pa)/da),pa=ka+Math.ceil(Math.abs(qa-pa)/da)+1,pa=fa(sa-za,pa-ka),fa=pa.xy,0V&&(R.top=V);null!==O&&R.right>O&&(R.right=O);null!==Y&&R.bottompa&&(fa.x-=pa=-pa);0>ka&&(fa.y-=ka=-ka);ea[da].ReloadStatus(fa.x,fa.y,pa,ka)}};this.UpdateElement=function(){this.RebuildElement()};this.RebuildElement= function(){if(z&&Q&&C){var R=K(F,C);if(null!=R){var aa=F.ToMapPoint(0,0),ea=F.ToMapPoint(F.getClientWidth(),F.getClientHeight());aa=new TGOS.TGEnvelope(aa.x,aa.y,ea.x,ea.y);aa=S(aa);A(C,R,aa);DEBUG_MODE&&console.log("getBoundTiles = "+q.length);ea=[];var da=q.length;for(i=0;iaa.right||za>aa.top||qa=this.maxFeaturesAllow&&(G=!1,k=!0,this.setWarningText(this.textTooManyGraphics));if(G){G=!1;var J=B.geom.Envelope;null!=J&&(J.left>t.right||J.rightt.top||J.top=t.count&&(void 0!==t.symbol&&null!=t.symbol&&(t.symbol.setMap(null),t.symbol=null),delete e[n]))}}};this.setVisible=function(e,g,h,l){e=e+"_"+g;if(void 0!==this.mFeatures[e]){e=this.mFeatures[e];g=h.length;for(var n=0;n"),l=l+H+": "+E,n.push({field:H,value:E})))}else for(p in h.attr)E=h.attr[p],void 0!==E&&(0"),l=l+p+": "+E,n.push({field:p,value:E}));f.graphicSelectedCallback?f.graphicSelectedCallback.call(g,{graphic:g,point:e.point,info:l,attr:n}):(null==f.messageBox&&(f.messageBox=new TGOS.TGInfoWindow(null, null,f.infoWindowOptions)),f.messageBox.setPosition(e.point),f.messageBox.setMessageText(l),f.messageBox.open(f.map))}}};this.hideInfo=function(){null!=f.messageBox&&(f.messageBox.setMessageText(""),f.messageBox.close())};this.setQueryable=function(e){this.queryable=e;for(var g in this.mFeatures){var h=this.mFeatures[g];if(void 0!==h)for(var l in h){var n=h[l];void 0!==n&&(n=n.symbol,void 0!==n&&(e?(TGOS.TGEvent.addListener(n,"click",f.showInfo),n.setCursor("pointer")):(void 0!==n.click_&&TGOS.TGEvent.removeListener(n.click_[0]), n.setCursor("default"))))}}};this.getQueryable=function(){return this.queryable}};TGOS.TGVectorTile=function(a,b){this.req=this.url=this.map=null;this.loaded=this.loading=!1;this.matrixSet=a.matrixSet;this.matrixId=a.matrixId;this.bound=a.bound;this.row=a.row;this.col=a.col;this.format=a.format;this.visible=!0;this.fid=[];this.equals=function(f){return this.matrixSet==f.matrixSet&&this.matrixId==f.matrixId&&this.row==f.row&&this.col==f.col};this.setVisible=function(f){this.visible=f;if(0O&&(O=0); 1=ka?0:Math.floor((ka-ea)/sa);da-=A;var qa=aa+Math.ceil(Math.abs(fa-ea)/sa)+1-aa;ea=[];var za=Infinity,Da=-Infinity,Ba=Infinity,Ia=-Infinity,Ka=0,La=0,Pa=[0,-1];for(fa=Math.pow(Math.max(da,qa),2);0Da&&(Da=Ka),LaIa&&(Ia=La));if(Ka===La||0>Ka&&Ka===-La||0R&&(S.intCoord=!0);var aa=w.format.indexOf("gml"),ea=w.format.indexOf("json"); 0<=aa||0<=R?(K=TGOS.parseXML(K),w.getGmlFeature(K,S)):0<=ea&&(K=JSON.parse(K),w.getJsonFeature(K,S))}}};w.xhr=A;A.open("GET",w.url,!0);A.send()}},D;this.finished=!1;this.UpdateElement=function(){if(L&&Y&&M&&(this.getAllFeatures().showWarning(!1),this.finished)){var w=F(C,M);if(null!=w){var u=M["ows:Identifier"],A=w["ows:Identifier"],K=C.ToMapPoint(0,0),S=C.ToMapPoint(C.getClientWidth(),C.getClientHeight());K=S=new TGOS.TGEnvelope(K.x,K.y,S.x,S.y);null!==p&&K.leftE&& (K.top=E);null!==H&&K.right>H&&(K.right=H);null!==B&&K.bottomS.right||aa.rightS.top||aa.top=n.count&&(void 0!==n.symbol&&null!=n.symbol&&(n.symbol.setMap(null),n.symbol=null),delete f[l]))}}};this.setVisible= function(f,e,g,h){f=f+"_"+e;if(void 0!==this.mFeatures[f]){f=this.mFeatures[f];e=g.length;for(var l=0;l"),h=h+E+": "+p,l.push({field:E,value:p})))}else for(k in g.attr)p=g.attr[k],void 0!==p&&(0"),h=h+k+": "+p,l.push({field:k,value:p}));b.graphicSelectedCallback?b.graphicSelectedCallback.call(e,{graphic:e,point:f.point,info:h,attr:l}):(null==b.messageBox&&(b.messageBox=new TGOS.TGInfoWindow(null,null,b.infoWindowOptions)),h=''+ h+"",b.messageBox.setPosition(f.point),b.messageBox.setMessageText(h),b.messageBox.open(b.map))}}};this.hideInfo=function(){null!=b.messageBox&&(b.messageBox.setMessageText(""),b.messageBox.close())};this.setQueryable=function(f){this.queryable=f;for(var e in this.mFeatures){var g=this.mFeatures[e];if(void 0!==g)for(var h in g){var l=g[h];void 0!==l&&(l=l.symbol,void 0!==l&&(f?(TGOS.TGEvent.addListener(l,"click",b.showInfo),l.setCursor("pointer")):(void 0!==l.click_&&TGOS.TGEvent.removeListener(l.click_[0]), l.setCursor("default"))))}}};this.getQueryable=function(){return this.queryable}};TGOS.TGVectorTilePoi=function(a,b){this.req=this.url=this.map=null;this.loaded=this.loading=!1;this.matrixSet=a.matrixSet;this.matrixId=a.matrixId;this.bound=a.bound;this.row=a.row;this.col=a.col;this.format=a.format;this.visible=!0;this.fid=[];this.equals=function(f){return this.matrixSet==f.matrixSet&&this.matrixId==f.matrixId&&this.row==f.row&&this.col==f.col};this.setVisible=function(f){this.visible=f;if(0=f.length)){e=void 0!==e?e*e:1;g=f[0];for(var h=[g],l,n=1,t=f.length;ne&&(h.push(l),g=l)}g!==l&&h.push(l);l=h;f=l.length;g=new ("undefined"!== typeof Uint8Array?Uint8Array:Array)(f);h=0;n=f-1;t=[];k=[];for(g[h]=g[n]=1;n;){var E=0;for(p=h+1;pE){var Q=p;E=H}}E>e&&(g[Q]=1,t.push(h,Q,Q,n));n=t.pop();h=t.pop()}for(p=0;pXa&&(Xa=0);1=jb?0:Math.floor((jb-Ua)/fb);for(Ua=ab+Math.ceil(Math.abs(Ca-Ua)/fb)+1;abE&&(xa.top=E);null!==H&&xa.right>H&&(xa.right=H);null!==B&& xa.bottomMa.right||Ua.rightMa.top||Ua.top]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:'".,<>?\u00ab\u00bb\u201c\u201d\u2018\u2019]))/ig;e.findUri={start:/\b(?:([a-z][a-z0-9.+-]*:\/\/)|www\.)/gi,end:/[\s\r\n]|$/,trim:/[`!()\[\]{};:'".,<>?\u00ab\u00bb\u201c\u201d\u201e\u2018\u2019]+$/,parens:/(\([^\)]*\)|\[[^\]]*\]|\{[^}]*\}|<[^>]*>)/g};e.leading_whitespace_expression=/^[\x00-\x20\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff]+/; e.ascii_tab_whitespace=/[\u0009\u000A\u000D]+/g;e.defaultPorts={http:"80",https:"443",ftp:"21",gopher:"70",ws:"80",wss:"443"};e.hostProtocols=["http","https"];e.invalid_hostname_characters=/[^a-zA-Z0-9\.\-:_]/;e.domAttributes={a:"href",blockquote:"cite",link:"href",base:"href",script:"src",form:"action",img:"src",area:"href",iframe:"src",embed:"src",source:"src",track:"src",input:"src",audio:"src",video:"src"};e.getDomAttribute=function(q){if(q&&q.nodeName){var m=q.nodeName.toLowerCase();if("input"!== m||"image"===q.type)return e.domAttributes[m]}};e.encode=H;e.decode=decodeURIComponent;e.iso8859=function(){e.encode=escape;e.decode=unescape};e.unicode=function(){e.encode=H;e.decode=decodeURIComponent};e.characters={pathname:{encode:{expression:/%(24|26|2B|2C|3B|3D|3A|40)/ig,map:{"%24":"$","%26":"&","%2B":"+","%2C":",","%3B":";","%3D":"=","%3A":":","%40":"@"}},decode:{expression:/[\/\?#]/g,map:{"/":"%2F","?":"%3F","#":"%23"}}},reserved:{encode:{expression:/%(21|23|24|26|27|28|29|2A|2B|2C|2F|3A|3B|3D|3F|40|5B|5D)/ig, map:{"%3A":":","%2F":"/","%3F":"?","%23":"#","%5B":"[","%5D":"]","%40":"@","%21":"!","%24":"$","%26":"&","%27":"'","%28":"(","%29":")","%2A":"*","%2B":"+","%2C":",","%3B":";","%3D":"="}}},urnpath:{encode:{expression:/%(21|24|27|28|29|2A|2B|2C|3B|3D|40)/ig,map:{"%21":"!","%24":"$","%27":"'","%28":"(","%29":")","%2A":"*","%2B":"+","%2C":",","%3B":";","%3D":"=","%40":"@"}},decode:{expression:/[\/\?#:]/g,map:{"/":"%2F","?":"%3F","#":"%23",":":"%3A"}}}};e.encodeQuery=function(q,m){q=e.encode(q+"");void 0=== m&&(m=e.escapeQuerySpace);return m?q.replace(/%20/g,"+"):q};e.decodeQuery=function(q,m){q+="";void 0===m&&(m=e.escapeQuerySpace);try{return e.decode(m?q.replace(/\+/g,"%20"):q)}catch(F){return q}};var I={encode:"encode",decode:"decode"},Q,U=function(q,m){return function(F){try{return e[m](F+"").replace(e.characters[q][m].expression,function(z){return e.characters[q][m].map[z]})}catch(z){return F}}};for(Q in I)e[Q+"PathSegment"]=U("pathname",I[Q]),e[Q+"UrnPathSegment"]=U("urnpath",I[Q]);I=function(q, m,F){return function(z){var D=F?function(A){return e[m](e[F](A))}:e[m];z=(z+"").split(q);for(var w=0,u=z.length;wz)return q.charAt(0)===m.charAt(0)&& "/"===q.charAt(0)?"/":"";if("/"!==q.charAt(z)||"/"!==m.charAt(z))z=q.substring(0,z).lastIndexOf("/");return q.substring(0,z+1)};e.withinString=function(q,m,F){F||={};var z=F.start||e.findUri.start,D=F.end||e.findUri.end,w=F.trim||e.findUri.trim,u=F.parens||e.findUri.parens,A=/[a-z0-9-]=["']?$/i;for(z.lastIndex=0;;){var K=z.exec(q);if(!K)break;var S=K.index;if(F.ignoreHtml){var R=q.slice(Math.max(S-3,0),S);if(R&&A.test(R))continue}var aa=S+q.slice(S).search(D);R=q.slice(S,aa);for(aa=-1;;){var ea=u.exec(R); if(!ea)break;aa=Math.max(aa,ea.index+ea[0].length)}R=-1m))throw new TypeError('Port "'+q+'" is not a valid port');}};e.noConflict=function(q){if(q)return q={URI:this.noConflict()},f.URITemplate&&"function"===typeof f.URITemplate.noConflict&&(q.URITemplate= f.URITemplate.noConflict()),f.IPv6&&"function"===typeof f.IPv6.noConflict&&(q.IPv6=f.IPv6.noConflict()),f.SecondLevelDomains&&"function"===typeof f.SecondLevelDomains.noConflict&&(q.SecondLevelDomains=f.SecondLevelDomains.noConflict()),q;f.URI===this&&(f.URI=J);return this};C.build=function(q){if(!0===q)this._deferred_build=!0;else if(void 0===q||this._deferred_build)this._string=e.build(this._parts),this._deferred_build=!1;return this};C.clone=function(){return new e(this)};C.valueOf=C.toString= function(){return this.build(!1)._string};C.protocol=B("protocol");C.username=B("username");C.password=B("password");C.hostname=B("hostname");C.port=B("port");C.query=G("query","?");C.fragment=G("fragment","#");C.search=function(q,m){q=this.query(q,m);return"string"===typeof q&&q.length?"?"+q:q};C.hash=function(q,m){q=this.fragment(q,m);return"string"===typeof q&&q.length?"#"+q:q};C.pathname=function(q,m){if(void 0===q||!0===q)return m=this._parts.path||(this._parts.hostname?"/":""),q?(this._parts.urn? e.decodeUrnPath:e.decodePath)(m):m;this._parts.path=this._parts.urn?q?e.recodeUrnPath(q):"":q?e.recodePath(q):"/";this.build(!m);return this};C.path=C.pathname;C.href=function(q,m){var F;if(void 0===q)return this.toString();this._string="";this._parts=e._parts();var z=q instanceof e,D="object"===typeof q&&(q.hostname||q.path||q.pathname);q.nodeName&&(D=e.getDomAttribute(q),q=q[D]||"",D=!1);!z&&D&&void 0!==q.pathname&&(q=q.toString());if("string"===typeof q||q instanceof String)this._parts=e.parse(String(q), this._parts);else if(z||D){q=z?q._parts:q;for(F in q)"query"!==F&&L.call(this._parts,F)&&(this._parts[F]=q[F]);q.query&&this.query(q.query,!1)}else throw new TypeError("invalid input");this.build(!m);return this};C.is=function(q){var m=!1,F=!1,z=!1,D=!1,w=!1,u=!1,A=!1,K=!this._parts.urn;this._parts.hostname&&(K=!1,F=e.ip4_expression.test(this._parts.hostname),z=e.ip6_expression.test(this._parts.hostname),m=F||z,w=(D=!m)&&b&&b.has(this._parts.hostname),u=D&&e.idn_expression.test(this._parts.hostname), A=D&&e.punycode_expression.test(this._parts.hostname));switch(q.toLowerCase()){case "relative":return K;case "absolute":return!K;case "domain":case "name":return D;case "sld":return w;case "ip":return m;case "ip4":case "ipv4":case "inet4":return F;case "ip6":case "ipv6":case "inet6":return z;case "idn":return u;case "url":return!this._parts.urn;case "urn":return!!this._parts.urn;case "punycode":return A}return null};var V=C.protocol,O=C.port,Y=C.hostname;C.protocol=function(q,m){if(q&&(q=q.replace(/:(\/\/)?$/, ""),!q.match(e.protocol_expression)))throw new TypeError('Protocol "'+q+"\" contains characters other than [A-Z0-9.+-] or doesn't start with [A-Z]");return V.call(this,q,m)};C.scheme=C.protocol;C.port=function(q,m){if(this._parts.urn)return void 0===q?"":this;void 0!==q&&(0===q&&(q=null),q&&(q+="",":"===q.charAt(0)&&(q=q.substring(1)),e.ensureValidPort(q)));return O.call(this,q,m)};C.hostname=function(q,m){if(this._parts.urn)return void 0===q?"":this;if(void 0!==q){var F={preventInvalidHostname:this._parts.preventInvalidHostname}; if("/"!==e.parseHost(q,F))throw new TypeError('Hostname "'+q+'" contains characters other than [A-Z0-9.-]');q=F.hostname;this._parts.preventInvalidHostname&&e.ensureValidHostname(q,this._parts.protocol)}return Y.call(this,q,m)};C.origin=function(q,m){if(this._parts.urn)return void 0===q?"":this;if(void 0===q)return m=this.protocol(),this.authority()?(m?m+"://":"")+this.authority():"";q=e(q);this.protocol(q.protocol()).authority(q.authority()).build(!m);return this};C.host=function(q,m){if(this._parts.urn)return void 0=== q?"":this;if(void 0===q)return this._parts.hostname?e.buildHost(this._parts):"";if("/"!==e.parseHost(q,this._parts))throw new TypeError('Hostname "'+q+'" contains characters other than [A-Z0-9.-]');this.build(!m);return this};C.authority=function(q,m){if(this._parts.urn)return void 0===q?"":this;if(void 0===q)return this._parts.hostname?e.buildAuthority(this._parts):"";if("/"!==e.parseAuthority(q,this._parts))throw new TypeError('Hostname "'+q+'" contains characters other than [A-Z0-9.-]');this.build(!m); return this};C.userinfo=function(q,m){if(this._parts.urn)return void 0===q?"":this;if(void 0===q)return(q=e.buildUserinfo(this._parts))?q.substring(0,q.length-1):q;"@"!==q[q.length-1]&&(q+="@");e.parseUserinfo(q,this._parts);this.build(!m);return this};C.resource=function(q,m){if(void 0===q)return this.path()+this.search()+this.hash();q=e.parse(q);this._parts.path=q.path;this._parts.query=q.query;this._parts.fragment=q.fragment;this.build(!m);return this};C.subdomain=function(q,m){if(this._parts.urn)return void 0=== q?"":this;if(void 0===q){if(!this._parts.hostname||this.is("IP"))return"";q=this._parts.hostname.length-this.domain().length-1;return this._parts.hostname.substring(0,q)||""}var F=this._parts.hostname.length-this.domain().length;F=this._parts.hostname.substring(0,F);F=new RegExp("^"+g(F));q&&"."!==q.charAt(q.length-1)&&(q+=".");if(-1!==q.indexOf(":"))throw new TypeError("Domains cannot contain colons");q&&e.ensureValidHostname(q,this._parts.protocol);this._parts.hostname=this._parts.hostname.replace(F, q);this.build(!m);return this};C.domain=function(q,m){if(this._parts.urn)return void 0===q?"":this;"boolean"===typeof q&&(m=q,q=void 0);if(void 0===q){if(!this._parts.hostname||this.is("IP"))return"";if((q=this._parts.hostname.match(/\./g))&&2>q.length)return this._parts.hostname;m=this._parts.hostname.length-this.tld(m).length-1;m=this._parts.hostname.lastIndexOf(".",m-1)+1;return this._parts.hostname.substring(m)||""}if(!q)throw new TypeError("cannot set domain empty");if(-1!==q.indexOf(":"))throw new TypeError("Domains cannot contain colons"); e.ensureValidHostname(q,this._parts.protocol);if(!this._parts.hostname||this.is("IP"))this._parts.hostname=q;else{var F=new RegExp(g(this.domain())+"$");this._parts.hostname=this._parts.hostname.replace(F,q)}this.build(!m);return this};C.tld=function(q,m){if(this._parts.urn)return void 0===q?"":this;"boolean"===typeof q&&(m=q,q=void 0);if(void 0===q){if(!this._parts.hostname||this.is("IP"))return"";q=this._parts.hostname.lastIndexOf(".");q=this._parts.hostname.substring(q+1);return!0!==m&&b&&b.list[q.toLowerCase()]? b.get(this._parts.hostname)||q:q}if(q)if(q.match(/[^a-zA-Z0-9-]/))if(b&&b.is(q)){var F=new RegExp(g(this.tld())+"$");this._parts.hostname=this._parts.hostname.replace(F,q)}else throw new TypeError('TLD "'+q+'" contains characters other than [A-Z0-9]');else{if(!this._parts.hostname||this.is("IP"))throw new ReferenceError("cannot set TLD on non-domain host");F=new RegExp(g(this.tld())+"$");this._parts.hostname=this._parts.hostname.replace(F,q)}else throw new TypeError("cannot set TLD empty");this.build(!m); return this};C.directory=function(q,m){if(this._parts.urn)return void 0===q?"":this;if(void 0===q||!0===q){if(!this._parts.path&&!this._parts.hostname)return"";if("/"===this._parts.path)return"/";m=this._parts.path.length-this.filename().length-1;m=this._parts.path.substring(0,m)||(this._parts.hostname?"/":"");return q?e.decodePath(m):m}var F=this._parts.path.length-this.filename().length;F=this._parts.path.substring(0,F);F=new RegExp("^"+g(F));this.is("relative")||(q||="/","/"!==q.charAt(0)&&(q= "/"+q));q&&"/"!==q.charAt(q.length-1)&&(q+="/");q=e.recodePath(q);this._parts.path=this._parts.path.replace(F,q);this.build(!m);return this};C.filename=function(q,m){if(this._parts.urn)return void 0===q?"":this;if("string"!==typeof q){if(!this._parts.path||"/"===this._parts.path)return"";m=this._parts.path.lastIndexOf("/");m=this._parts.path.substring(m+1);return q?e.decodePathSegment(m):m}var F=!1;"/"===q.charAt(0)&&(q=q.substring(1));q.match(/\.?\//)&&(F=!0);var z=new RegExp(g(this.filename())+ "$");q=e.recodePath(q);this._parts.path=this._parts.path.replace(z,q);F?this.normalizePath(m):this.build(!m);return this};C.suffix=function(q,m){if(this._parts.urn)return void 0===q?"":this;if(void 0===q||!0===q){if(!this._parts.path||"/"===this._parts.path)return"";m=this.filename();var F=m.lastIndexOf(".");if(-1===F)return"";m=m.substring(F+1);m=/^[a-z0-9%]+$/i.test(m)?m:"";return q?e.decodePathSegment(m):m}"."===q.charAt(0)&&(q=q.substring(1));F=this.suffix();if(F)var z=q?new RegExp(g(F)+"$"): new RegExp(g("."+F)+"$");else{if(!q)return this;this._parts.path+="."+e.recodePath(q)}z&&(q=e.recodePath(q),this._parts.path=this._parts.path.replace(z,q));this.build(!m);return this};C.segment=function(q,m,F){var z=this._parts.urn?":":"/",D=this.path(),w="/"===D.substring(0,1);D=D.split(z);void 0!==q&&"number"!==typeof q&&(F=m,m=q,q=void 0);if(void 0!==q&&"number"!==typeof q)throw Error('Bad segment "'+q+'", must be 0-based integer');w&&D.shift();0>q&&(q=Math.max(D.length+q,0));if(void 0===m)return void 0=== q?D:D[q];if(null===q||void 0===D[q])if(l(m)){D=[];q=0;for(var u=m.length;q\x3c/script>");document.write("