(function(){Array.prototype.indexOf||(Array.prototype.indexOf=function(d,a){var b=this.length>>>0,e=Number(a)||0,e=0>e?Math.ceil(e):Math.floor(e);for(0>e&&(e+=b);ed.right||a.rightd.bottom||a.bottom=f.length)){for(var a=void 0!==d?d*d:1,e=f[0],g=[e],h,k=1,l=f.length;ka&&(g.push(h),e=h)}e!==h&&g.push(h);h=g;var f=h.length,e=new ("undefined"!==typeof Uint8Array?Uint8Array:Array)(f),g=0,k=f-1,l=[],p=[],n,u,s;for(e[g]=e[k]=1;k;){n=0;for(m=g+1;mn&&(s=m,n=u)}n>a&&(e[s]=1,l.push(g,s,s,k));k=l.pop();g=l.pop()}for(m=0;ml.length-1?l.length-1:0>a?0:a;if((a>=l.length||0>a)&&p==b)return!1;p=b;m=g(p);return!0};this.getScale=function(){return h*m};this.putScale=function(a){this.putMapLevel(e(a/h))};this.getScaleX=function(){return h*m};this.getScaleY=function(){return k*m};this.getLevelScale=function(a){return h* g(a)}}; function CachedLevelTransformation(b){function d(a){for(var b=0,b=0;bg.length-1?g.length-1:0>b?0:b;if((b>=g.length||0>b)&&k==d)return!1;k=d;l=a(k);return!0};this.getScale=function(){return f*l};this.putScale=function(a){this.putMapLevel(d(a/f))};this.getScaleX=function(){return f*l};this.getScaleY=function(){return e* l};this.getLevelScale=function(b){return f*a(b)}} function MapCachedLayer(b,d,a,f,e,g,h){function k(a,b){function e(a,m,k,n){for(var v=0;vl&&(f.x-=l=-l);0>h&&(f.y-=h=-h);d[e].ReloadStatus(f.x,f.y,l,h)}};this.getTiles=function(a,e,f,g,m){a=p.ToMapDistX(1);p.ToMapDistY(1);m=0;if(0f&&(f=h), lm&&(m=l));if(h===l||0>h&&h===-l||0u[A].zIndex&&(C[u[A].zIndex]=u[A]));for(w.sort(f);0>w[s];)if(q=C[w[s++]],B.push(q.apply(b,h)),g)return g=d,B;for(A=0;Ae;e+=2){var g=[{x:+a[e-2],y:+a[e-1]},{x:+a[e],y:+a[e+1]},{x:+a[e+2],y:+a[e+3]},{x:+a[e+4],y:+a[e+5]}];b?e?f-4==e?g[3]={x:+a[0],y:+a[1]}:f-2==e&&(g[2]={x:+a[0],y:+a[1]},g[3]={x:+a[2],y:+a[3]}):g[0]={x:+a[f-2],y:+a[f-1]}:f-4==e?g[3]=g[2]:e||(g[0]={x:+a[e],y:+a[e+1]});d.push(["C",(-g[0].x+6*g[1].x+g[2].x)/6,(-g[0].y+6*g[1].y+g[2].y)/6,(g[1].x+6*g[2].x-g[3].x)/6,(g[1].y+6*g[2].y-g[3].y)/6,g[2].x,g[2].y])}return d} function k(a,b,d,e,f,g,m,h,k){null==k&&(k=1);k=(1k?0:k)/2;for(var l=[-0.1252,0.1252,-0.3678,0.3678,-0.5873,0.5873,-0.7699,0.7699,-0.9041,0.9041,-0.9816,0.9816],n=[0.2491,0.2491,0.2335,0.2335,0.2032,0.2032,0.1601,0.1601,0.1069,0.1069,0.0472,0.0472],v=0,t=0;12>t;t++)var p=k*l[t]+k,E=p*(p*(-3*a+9*d-9*f+3*m)+6*a-12*d+6*f)-3*a+3*d,p=p*(p*(-3*b+9*e-9*g+3*h)+6*b-12*e+6*g)-3*b+3*e,v=v+n[t]*N.sqrt(E*E+p*p);return k*v}function l(a,b,d,e,f,g,m,h,l){if(!(0>l||k(a,b,d,e,f,g,m,h)T(K.x-U.x)?"y":"x",ma=0.001>T(I.x-F.x)?"y":"x",M;M=U.x;var X=U.y,N=K.x,ta= K.y,pa=F.x,ja=F.y,O=I.x,Z=I.y;if(Q(M,N)<$(pa,O)||$(M,N)>Q(pa,O)||Q(X,ta)<$(ja,Z)||$(X,ta)>Q(ja,Z))M=void 0;else{var S=(M*ta-X*N)*(pa-O)-(M-N)*(pa*Z-ja*O),aa=(M*ta-X*N)*(ja-Z)-(X-ta)*(pa*Z-ja*O),ra=(M-N)*(ja-Z)-(X-ta)*(pa-O);if(ra){var S=S/ra,aa=aa/ra,ra=+S.toFixed(2),za=+aa.toFixed(2);M=ra<+$(M,N).toFixed(2)||ra>+Q(M,N).toFixed(2)||ra<+$(pa,O).toFixed(2)||ra>+Q(pa,O).toFixed(2)||za<+$(X,ta).toFixed(2)||za>+Q(X,ta).toFixed(2)||za<+$(ja,Z).toFixed(2)||za>+Q(ja,Z).toFixed(2)?void 0:{x:S,y:aa}}else M= void 0}M&&J[M.x.toFixed(4)]!=M.y.toFixed(4)&&(J[M.x.toFixed(4)]=M.y.toFixed(4),U=U.t+T((M[Y]-U[Y])/(K[Y]-U[Y]))*(K.t-U.t),F=F.t+T((M[ma]-F[ma])/(I[ma]-F[ma]))*(I.t-F.t),0<=U&&1.001>=U&&0<=F&&1.001>=F&&(w?H++:H.push({x:M.x,y:M.y,t1:$(U,1),t2:$(F,1)})))}w=H}else w=w?0:[];if(e)q+=w;else{B=0;for(P=w.length;Be;e++){g=((l*f+k)*f+h)*f-a;if(T(g)T(d))break;f-=g/d}d=0;e=1;f=a;if(fe)return e;for(;dg?d=f:e=f;f=(e-d)/2+d}return f}var h=3*b,k=3*(e-b)-h,l=1-h-k,n=3*d,v=3*(f-d)-n,t=1-n-v;return function(a,b){var d=m(a,b);return((t*d+v)*d+n)*d}(a, 1/(200*g))}function s(a,b){var d=[],e={};this.ms=b;this.times=1;if(a){for(var f in a)a[I](f)&&(e[W(f)]=a[f],d.push(W(f)));d.sort(X)}this.anim=e;this.top=d[d.length-1];this.percents=d}function q(b,e,f,g,h,k){f=W(f);var l,n,t,p,E,q,z=b.ms,s={},w={},A={};if(g)for(q=0,G=ca.length;qg*b.top){f=b.percents[q]; E=b.percents[q-1]||0;z=z/b.top*(f-E);p=b.percents[q+1];l=b.anim[f];break}else g&&e.attr(b.anim[b.percents[q]]);if(l){if(n)n.initstatus=g,n.start=new Date-n.ms*g;else{for(var D in l)if(l[I](D)&&(Aa[I](D)||e.paper.customAttributes[I](D)))switch(s[D]=e.attr(D),null==s[D]&&(s[D]=ha[D]),w[D]=l[D],Aa[D]){case S:A[D]=(w[D]-s[D])/z;break;case "colour":s[D]=a.getRGB(s[D]);q=a.getRGB(w[D]);A[D]={r:(q.r-s[D].r)/z,g:(q.g-s[D].g)/z,b:(q.b-s[D].b)/z};break;case "path":q=La(s[D],w[D]);F=q[1];s[D]=q[0];A[D]=[];q= 0;for(G=s[D].length;q';za=ta.firstChild;za.style.behavior="url(#default#VML)";if(!za||"object"!=typeof za.adj)return a.type="";ta=null}a.svg=!(a.vml="VML"==a.type);a._Paper=K;a.fn=F=K.prototype=a.prototype;a._id=0;a._oid=0;a.is=function(a,b){b=M.call(b);return"finite"==b?!ia[I](+a):"array"==b?a instanceof Array:"null"==b&&null===a||b==typeof a&&null!==a||"object"==b&&a===Object(a)||"array"==b&&Array.isArray&&Array.isArray(a)|| ka.call(a).slice(8,-1).toLowerCase()==b};a.angle=function(b,d,e,f,g,m){return null==g?(b-=e,d-=f,b||d?(180*N.atan2(-d,-b)/O+540)%360:0):a.angle(b,d,g,m)-a.angle(e,f,g,m)};a.rad=function(a){return a%360*O/180};a.deg=function(a){return Math.round(1E3*(180*a/O%360))/1E3};a.snapTo=function(b,d,e){e=a.is(e,"finite")?e:10;if(a.is(b,R))for(var f=b.length;f--;){if(T(b[f]-d)<=e)return b[f]}else{b=+b;f=d%b;if(fb-e)return d-f+b}return d};a.createUUID=function(a,b){return function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(a, b).toUpperCase()}}(/[xy]/g,function(a){var b=16*N.random()|0;return("x"==a?b:b&3|8).toString(16)});a.setWindow=function(b){d("raphael.setWindow",a,G.win,b);G.win=b;G.doc=G.win.document;a._engine.initWin&&a._engine.initWin(G.win)};var ra=function(b){if(a.vml){var d=/^\s+|\s+$/g,f;try{var g=new ActiveXObject("htmlfile");g.write("");g.close();f=g.body}catch(m){f=createPopup().document.body}var h=f.createTextRange();ra=e(function(a){try{f.style.color=L(a).replace(d,"");var b=h.queryCommandValue("ForeColor"); return"#"+("000000"+((b&255)<<16|b&65280|(b&16711680)>>>16).toString(16)).slice(-6)}catch(e){return"none"}})}else{var k=G.doc.createElement("i");k.title="Rapha\u00ebl Colour Picker";k.style.display="none";G.doc.body.appendChild(k);ra=e(function(a){k.style.color=a;return G.doc.defaultView.getComputedStyle(k,"").getPropertyValue("color")})}return ra(b)},Ia=function(){return"hsb("+[this.h,this.s,this.b]+")"},Ea=function(){return"hsl("+[this.h,this.s,this.l]+")"},Ca=function(){return this.hex},Ha=function(b, d,e){null==d&&a.is(b,"object")&&"r"in b&&"g"in b&&"b"in b&&(e=b.b,d=b.g,b=b.r);null==d&&a.is(b,"string")&&(e=a.getRGB(b),b=e.r,d=e.g,e=e.b);if(1d?d:1-d);b=m*(1-T(a%2-1));d=f=g=d-m/2;a=~~a;d+=[m,b,0,0,b,m][a];f+=[b,m,m,b,0,0][a];g+=[0,0,b,m,m,b][a];return Ma(d,f,g,e)};a.rgb2hsb=function(a,b,d){d=Ha(a,b,d);a=d[0];b=d[1];d=d[2];var e,f;e=Q(a,b,d);f=e-$(a,b,d);a=60*(((0==f?0:e==a?(b-d)/f:e==b?(d-a)/f+2:(a-b)/f+4)+360)%6)/360;return{h:a,s:0==f?0:f/e,b:e,toString:Ia}};a.rgb2hsl=function(a, b,d){d=Ha(a,b,d);a=d[0];b=d[1];d=d[2];var e,f,g;e=Q(a,b,d);f=$(a,b,d);g=e-f;a=60*(((0==g?0:e==a?(b-d)/g:e==b?(d-a)/g+2:(a-b)/g+4)+360)%6)/360;e=(e+f)/2;return{h:a,s:0==g?0:0.5>e?g/(2*e):g/(2-2*e),l:e,toString:Ea}};a._path2string=function(){return this.join(",").replace(Da,"$1")};a._preload=function(a,b){var d=G.doc.createElement("img");d.style.cssText="position:absolute;left:-9999em;top:-9999em";d.onload=function(){b.call(this);this.onload=null;G.doc.body.removeChild(this)};d.onerror=function(){G.doc.body.removeChild(this)}; G.doc.body.appendChild(d);d.src=a};a.getRGB=e(function(b){if(!b||(b=L(b)).indexOf("-")+1)return{r:-1,g:-1,b:-1,hex:"none",error:1,toString:g};if("none"==b)return{r:-1,g:-1,b:-1,hex:"none",toString:g};!xa[I](b.toLowerCase().substring(0,2))&&"#"!=b.charAt()&&(b=ra(b));var d,e,f,m,h;if(b=b.match(V)){b[2]&&(f=ba(b[2].substring(5),16),e=ba(b[2].substring(3,5),16),d=ba(b[2].substring(1,3),16));b[3]&&(f=ba((h=b[3].charAt(3))+h,16),e=ba((h=b[3].charAt(2))+h,16),d=ba((h=b[3].charAt(1))+h,16));b[4]&&(h=b[4][P](ya), d=W(h[0]),"%"==h[0].slice(-1)&&(d*=2.55),e=W(h[1]),"%"==h[1].slice(-1)&&(e*=2.55),f=W(h[2]),"%"==h[2].slice(-1)&&(f*=2.55),"rgba"==b[1].toLowerCase().slice(0,4)&&(m=W(h[3])),h[3]&&"%"==h[3].slice(-1)&&(m/=100));if(b[5])return h=b[5][P](ya),d=W(h[0]),"%"==h[0].slice(-1)&&(d*=2.55),e=W(h[1]),"%"==h[1].slice(-1)&&(e*=2.55),f=W(h[2]),"%"==h[2].slice(-1)&&(f*=2.55),"deg"!=h[0].slice(-3)&&"\u00b0"!=h[0].slice(-1)||(d/=360),"hsba"==b[1].toLowerCase().slice(0,4)&&(m=W(h[3])),h[3]&&"%"==h[3].slice(-1)&&(m/= 100),a.hsb2rgb(d,e,f,m);if(b[6])return h=b[6][P](ya),d=W(h[0]),"%"==h[0].slice(-1)&&(d*=2.55),e=W(h[1]),"%"==h[1].slice(-1)&&(e*=2.55),f=W(h[2]),"%"==h[2].slice(-1)&&(f*=2.55),"deg"!=h[0].slice(-3)&&"\u00b0"!=h[0].slice(-1)||(d/=360),"hsla"==b[1].toLowerCase().slice(0,4)&&(m=W(h[3])),h[3]&&"%"==h[3].slice(-1)&&(m/=100),a.hsl2rgb(d,e,f,m);b={r:d,g:e,b:f,toString:g};b.hex="#"+(16777216|f|e<<8|d<<16).toString(16).slice(1);a.is(m,"finite")&&(b.opacity=m);return b}return{r:-1,g:-1,b:-1,hex:"none",error:1, toString:g}},a);a.hsb=e(function(b,d,e){return a.hsb2rgb(b,d,e).hex});a.hsl=e(function(b,d,e){return a.hsl2rgb(b,d,e).hex});a.rgb=e(function(a,b,d){return"#"+(16777216|d|b<<8|a<<16).toString(16).slice(1)});a.getColor=function(a){a=this.getColor.start=this.getColor.start||{h:0,s:1,b:a||0.75};var b=this.hsb2rgb(a.h,a.s,a.b);a.h+=0.075;1=a.s&&(this.getColor.start={h:0,s:1,b:a.b}));return b.hex};a.getColor.reset=function(){delete this.start};a.parsePathString=function(b){if(!b)return null; var d=va(b);if(d.arr)return qa(d.arr);var e={a:7,c:6,h:1,l:2,m:2,r:4,q:4,s:4,t:2,v:1,z:0},f=[];a.is(b,R)&&a.is(b[0],R)&&(f=qa(b));f.length||L(b).replace(fa,function(a,b,d){var g=[];a=b.toLowerCase();d.replace(ua,function(a,b){b&&g.push(+b)});"m"==a&&2=e[a]&&(f.push([b][v](g.splice(0,e[a]))),e[a]););});f.toString=a._path2string;d.arr=qa(f);return f};a.parseTransformString=e(function(b){if(!b)return null; var d=[];a.is(b,R)&&a.is(b[0],R)&&(d=qa(b));d.length||L(b).replace(oa,function(a,b,e){var f=[];M.call(b);e.replace(ua,function(a,b){b&&f.push(+b)});d.push([b][v](f))});d.toString=a._path2string;return d});var va=function(a){var b=va.ps=va.ps||{};b[a]?b[a].sleep=100:b[a]={sleep:100};setTimeout(function(){for(var d in b)b[I](d)&&d!=a&&(b[d].sleep--,!b[d].sleep&&delete b[d])});return b[a]};a.findDotsAtSegment=function(a,b,d,e,f,g,m,h,k){var l=1-k,n=aa(l,3),v=aa(l,2),t=k*k,q=t*k,p=n*a+3*v*k*d+3*l*k*k* f+q*m,n=n*b+3*v*k*e+3*l*k*k*g+q*h,v=a+2*k*(d-a)+t*(f-2*d+a),q=b+2*k*(e-b)+t*(g-2*e+b),E=d+2*k*(f-d)+t*(m-2*f+d),t=e+2*k*(g-e)+t*(h-2*g+e);a=l*a+k*d;b=l*b+k*e;f=l*f+k*m;g=l*g+k*h;h=90-180*N.atan2(v-E,q-t)/O;(v>E||q=a.x&&b<=a.x2&&d>=a.y&&d<=a.y2};a.isBBoxIntersect=function(b,d){var e=a.isPointInsideBBox;return e(d,b.x,b.y)||e(d,b.x2,b.y)||e(d,b.x,b.y2)||e(d,b.x2,b.y2)||e(b,d.x,d.y)||e(b,d.x2,d.y)||e(b,d.x,d.y2)||e(b,d.x2,d.y2)||(b.xd.x||d.xb.x)&&(b.yd.y||d.yb.y)};a.pathIntersection=function(a,b){return p(a,b)};a.pathIntersectionNumber=function(a,b){return p(a,b,1)};a.isPointInsidePath=function(b,d,e){var f=a.pathBBox(b);return a.isPointInsideBBox(f, d,e)&&1==p(b,[["M",d,e],["H",f.x2+10]],1)%2};a._removedFactory=function(a){return function(){d("raphael.log",null,"Rapha\u00ebl: you are calling to method \u201c"+a+"\u201d of removed object",a)}};var Fa=a.pathBBox=function(a){var b=va(a);if(b.bbox)return f(b.bbox);if(!a)return{x:0,y:0,width:0,height:0,x2:0,y2:0};a=La(a);for(var d=0,e=0,g=[],h=[],m,k=0,l=a.length;kw&&(w=2*O+w);0>E&&(E=2*O+E);h&&w>E&&(w-=2*O);!h&&E>w&&(E-=2*O)}if(T(E-w)>t){var p=E,u=k,A=l;E=w+t*(h&&E>w?1:-1);k=m+d*N.cos(E);l=s+f*N.sin(E);p=cb(k,l,d,f,g,0,h,u,A,[E,p,m,s])}m=E-w;g=N.cos(w); t=N.sin(w);h=N.cos(E);E=N.sin(E);m=N.tan(m/4);d=4/3*d*m;m*=4/3*f;f=[a,b];a=[a+d*t,b-m*g];b=[k+d*E,l-m*h];k=[k,l];a[0]=2*f[0]-a[0];a[1]=2*f[1]-a[1];if(n)return[a,b,k][v](p);p=[a,b,k][v](p).join()[P](",");n=[];k=0;for(l=p.length;kv&&(v=Qa(a,b,d,e,f,g,m,h,v),q.push(v.x),E.push(v.y));0k&&(v=Qa(a,b,d,e,f,g,m,h,k),q.push(v.x),E.push(v.y));k=g-2*e+b-(h-2*g+e);l=2*(e-b)-2*(g-e);n=b-e;v=(-l+N.sqrt(l*l-4*k*n))/2/k;k=(-l-N.sqrt(l*l-4*k*n))/2/k;"1e12"v&&(v=Qa(a,b,d,e,f,g,m,h,v),q.push(v.x),E.push(v.y));0k&&(v=Qa(a,b,d,e,f,g,m,h,k),q.push(v.x),E.push(v.y)); return{min:{x:$[t](0,q),y:$[t](0,E)},max:{x:Q[t](0,q),y:Q[t](0,E)}}}),La=a._path2curve=e(function(a,b){var d=!b&&va(a);if(!b&&d.curve)return qa(d.curve);var e=Ja(a),f=b&&Ja(b),g={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},m={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},h=function(a,b,d){if(!a)return["C",b.x,b.y,b.x,b.y,b.x,b.y];a[0]in{T:1,Q:1}||(b.qx=b.qy=null);switch(a[0]){case "M":b.X=a[1];b.Y=a[2];break;case "A":a=["C"][v](cb[t](0,[b.x,b.y][v](a.slice(1))));break;case "S":"C"==d||"S"==d?(d=2*b.x- b.bx,b=2*b.y-b.by):(d=b.x,b=b.y);a=["C",d,b][v](a.slice(1));break;case "T":"Q"==d||"T"==d?(b.qx=2*b.x-b.qx,b.qy=2*b.y-b.qy):(b.qx=b.x,b.qy=b.y);a=["C"][v](Oa(b.x,b.y,b.qx,b.qy,a[1],a[2]));break;case "Q":b.qx=a[1];b.qy=a[2];a=["C"][v](Oa(b.x,b.y,a[1],a[2],a[3],a[4]));break;case "L":a=["C"][v]([b.x,b.y,a[1],a[2],a[1],a[2]]);break;case "H":a=["C"][v]([b.x,b.y,a[1],b.y,a[1],b.y]);break;case "V":a=["C"][v]([b.x,b.y,b.x,a[1],b.x,a[1]]);break;case "Z":a=["C"][v]([b.x,b.y,b.X,b.Y,b.X,b.Y])}return a},k=function(a, b){if(7a;a++)for(d=0;3>d;d++){for(e=f=0;3>e;e++)f+=k[a][e]* b[e][d];h[a][d]=f}this.a=h[0][0];this.b=h[1][0];this.c=h[0][1];this.d=h[1][1];this.e=h[0][2];this.f=h[1][2]};b.invert=function(){var a=this.a*this.d-this.b*this.c;return new m(this.d/a,-this.b/a,-this.c/a,this.a/a,(this.c*this.f-this.d*this.e)/a,(this.b*this.e-this.a*this.f)/a)};b.clone=function(){return new m(this.a,this.b,this.c,this.d,this.e,this.f)};b.translate=function(a,b){this.add(1,0,0,1,a,b)};b.scale=function(a,b,d,e){null==b&&(b=a);(d||e)&&this.add(1,0,0,1,d,e);this.add(a,0,0,b,0,0);(d|| e)&&this.add(1,0,0,1,-d,-e)};b.rotate=function(b,d,e){b=a.rad(b);d=d||0;e=e||0;var f=+N.cos(b).toFixed(9);b=+N.sin(b).toFixed(9);this.add(f,b,-b,f,d,e);this.add(1,0,0,1,-d,-e)};b.x=function(a,b){return a*this.a+b*this.c+this.e};b.y=function(a,b){return a*this.b+b*this.d+this.f};b.get=function(a){return+this[L.fromCharCode(97+a)].toFixed(4)};b.toString=function(){return a.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()};b.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')"};b.offset=function(){return[this.e.toFixed(4),this.f.toFixed(4)]};b.split=function(){var b={};b.dx=this.e;b.dy=this.f;var f=[[this.a,this.c],[this.b,this.d]];b.scalex=N.sqrt(d(f[0]));e(f[0]);b.shear=f[0][0]*f[1][0]+f[0][1]*f[1][1];f[1]=[f[1][0]-f[0][0]* b.shear,f[1][1]-f[0][1]*b.shear];b.scaley=N.sqrt(d(f[1]));e(f[1]);b.shear/=b.scaley;var g=-f[0][1],f=f[1][1];0>f?(b.rotate=a.deg(N.acos(f)),0>g&&(b.rotate=360-b.rotate)):b.rotate=a.deg(N.asin(g));b.isSimple=!+b.shear.toFixed(9)&&(b.scalex.toFixed(9)==b.scaley.toFixed(9)||!b.rotate);b.isSuperSimple=!+b.shear.toFixed(9)&&b.scalex.toFixed(9)==b.scaley.toFixed(9)&&!b.rotate;b.noRotation=!+b.shear.toFixed(9)&&!b.rotate;return b};b.toTransformString=function(a){a=a||this[P]();return a.isSimple?(a.scalex= +a.scalex.toFixed(4),a.scaley=+a.scaley.toFixed(4),a.rotate=+a.rotate.toFixed(4),(a.dx||a.dy?"t"+[a.dx,a.dy]:"")+(1!=a.scalex||1!=a.scaley?"s"+[a.scalex,a.scaley,0,0]:"")+(a.rotate?"r"+[a.rotate,0,0]:"")):"m"+[this.get(0),this.get(1),this.get(2),this.get(3),this.get(4),this.get(5)]}})(m.prototype);for(var kb=function(){this.returnValue=!1},lb=function(){return this.originalEvent.preventDefault()},mb=function(){this.cancelBubble=!0},nb=function(){return this.originalEvent.stopPropagation()},eb=function(a){return{x:a.clientX+ (G.doc.documentElement.scrollLeft||G.doc.body.scrollLeft),y:a.clientY+(G.doc.documentElement.scrollTop||G.doc.body.scrollTop)}},ob=function(){if(G.doc.addEventListener)return function(a,b,d,e){var f=function(a){var b=eb(a);return d.call(e,a,b.x,b.y)};a.addEventListener(b,f,!1);if(z&&Y[b]){var g=function(b){for(var f=eb(b),g=b,m=0,h=b.targetTouches&&b.targetTouches.length;mf){if(d&&!n.start){m=Va(m,h,k[1],k[2],k[3],k[4],k[5],k[6],f-t);v+=["C"+m.start.x, m.start.y,m.m.x,m.m.y,m.x,m.y];if(g)return v;n.start=v;v=["M"+m.x,m.y+"C"+m.n.x,m.n.y,m.end.x,m.end.y,k[5],k[6]].join();t+=l;m=+k[5];h=+k[6];continue}if(!b&&!d)return m=Va(m,h,k[1],k[2],k[3],k[4],k[5],k[6],f-t),{x:m.x,y:m.y,alpha:m.alpha}}t+=l;m=+k[5];h=+k[6]}v+=k.shift()+k}n.end=v;m=b?t:d?n:a.findDotsAtSegment(m,h,k[0],k[1],k[2],k[3],k[4],k[5],1);m.alpha&&(m={x:m.x,y:m.y,alpha:m.alpha});return m}},gb=Wa(1),hb=Wa(),Xa=Wa(0,1);a.getTotalLength=gb;a.getPointAtLength=hb;a.getSubpath=function(a,b,d){if(1E-6> this.getTotalLength(a)-d)return Xa(a,b).end;a=Xa(a,d,1);return b?Xa(a,b).end:a};ea.getTotalLength=function(){var a=this.getPath();if(a)return this.node.getTotalLength?this.node.getTotalLength():gb(a)};ea.getPointAtLength=function(a){var b=this.getPath();if(b)return hb(b,a)};ea.getPath=function(){var b,d=a._getPath[this.type];if("text"!=this.type&&"set"!=this.type)return d&&(b=d(this)),b};ea.getSubpath=function(b,d){var e=this.getPath();if(e)return a.getSubpath(e,b,d)};var wa=a.easing_formulas={linear:function(a){return a}, "<":function(a){return aa(a,1.7)},">":function(a){return aa(a,0.48)},"<>":function(a){var b=0.48-a/1.04,d=N.sqrt(0.1734+b*b);a=d-b;a=aa(T(a),1/3)*(0>a?-1:1);b=-d-b;b=aa(T(b),1/3)*(0>b?-1:1);a=a+b+0.5;return 3*(1-a)*a*a+a*a*a},backIn:function(a){return a*a*(2.70158*a-1.70158)},backOut:function(a){a-=1;return a*a*(2.70158*a+1.70158)+1},elastic:function(a){return a==!!a?a:aa(2,-10*a)*N.sin(2*(a-0.075)*O/0.3)+1},bounce:function(a){a<1/2.75?a*=7.5625*a:a<2/2.75?(a-=1.5/2.75,a=7.5625*a*a+0.75):a<2.5/2.75? (a-=2.25/2.75,a=7.5625*a*a+0.9375):(a-=2.625/2.75,a=7.5625*a*a+0.984375);return a}};wa.easeIn=wa["ease-in"]=wa["<"];wa.easeOut=wa["ease-out"]=wa[">"];wa.easeInOut=wa["ease-in-out"]=wa["<>"];wa["back-in"]=wa.backIn;wa["back-out"]=wa.backOut;var ca=[],ab=b.requestAnimationFrame||b.webkitRequestAnimationFrame||b.mozRequestAnimationFrame||b.oRequestAnimationFrame||b.msRequestAnimationFrame||function(a){setTimeout(a,16)},Sa=function(){for(var b=+new Date,e=0;eg))if(ga?0:a};ea.animateWith=function(b,d,e,f,g,m){if(this.removed)return m&&m.call(this),this;e=e instanceof s?e:a.animation(e,f,g,m);q(e,this,e.percents[0],null,this.attr());e=0;for(f=ca.length;ee&&(e=g);e+="%";!b[e].callback&&(b[e].callback=f)}return new s(b,d)};ea.animate=function(b,d,e,f){if(this.removed)return f&&f.call(this),this;b=b instanceof s?b:a.animation(b,d,e,f);q(b,this,b.percents[0],null,this.attr());return this};ea.setTime=function(a,b){a&&null!=b&&this.status(a,$(b,a.ms)/a.ms);return this};ea.status=function(a,b){var d=[],e=0,f,g;if(null!=b)return q(a,this,-1,$(b,1)),this;for(f=ca.length;ea?Q(this.length+a,0):a;b=Q(0,$(this.length-a,b));var e=[],f=[],g=[],m;for(m=2;mu[2]&&(u[0]=-u[2],u[2]=0);0>u[3]&&(u[1]=-u[3],u[3]=0)}var w=a._parseDots(k);if(!w)return null;v=v.replace(/[\(\)\s,\xb0#]/g,"_");e.gradient&&v!=e.gradient.id&&(p.defs.removeChild(e.gradient),delete e.gradient);if(!e.gradient)for(s=t(l+"Gradient",{id:v}), e.gradient=s,t(s,"radial"==l?{fx:n,fy:q}:{x1:u[0],y1:u[1],x2:u[2],y2:u[3],gradientTransform:e.matrix.invert()}),p.defs.appendChild(s),p=0,u=w.length;pb*d?-1:1);g&&(f=s(g,e,f),e=f.dx,f=f.dy);0>b&&(t+="x");0>d&&(t+=" y")&&(v=-1);n.flip=t;a.coordorigin=e*-q+" "+f*-E;if(l||m.fillsize)e=(e=a.getElementsByTagName("fill"))&&e[0],a.removeChild(e),l&&(f=s(g,k.x(l[0],l[1]),k.y(l[0],l[1])),e.position=f.dx*v+" "+f.dy*v),m.fillsize&&(e.size=m.fillsize[0]*h(b)+" "+m.fillsize[1]*h(d)),a.appendChild(e);n.visibility="visible"}};a.toString=function(){return"Your browser doesn\u2019t support SVG. Falling down to VML.\nYou are running Rapha\u00ebl "+this.version}; var A=function(a,d,e){d=b(d).toLowerCase().split("-");e=e?"end":"start";for(var f=d.length,g="classic",m="medium",h="medium";f--;)switch(d[f]){case "block":case "classic":case "oval":case "diamond":case "open":case "none":g=d[f];break;case "wide":case "narrow":h=d[f];break;case "long":case "short":m=d[f]}a=a.node.getElementsByTagName("stroke")[0];a[e+"arrow"]=g;a[e+"arrowlength"]=m;a[e+"arrowwidth"]=h},w=function(e,h){e.attrs=e.attrs||{};var l=e.node,n=e.attrs,v=l.style,t=E[e.type]&&(h.x!=n.x||h.y!= n.y||h.width!=n.width||h.height!=n.height||h.cx!=n.cx||h.cy!=n.cy||h.rx!=n.rx||h.ry!=n.ry||h.r!=n.r),q=p[e.type]&&(n.cx!=h.cx||n.cy!=h.cy||n.r!=h.r||n.rx!=h.rx||n.ry!=h.ry),s;for(s in h)h.hasOwnProperty(s)&&(n[s]=h[s]);t&&(n.path=a._getPath[e.type](e),e._.dirty=1);h.href&&(l.href=h.href);h.title&&(l.title=h.title);h.target&&(l.target=h.target);h.cursor&&(v.cursor=h.cursor);"blur"in h&&e.blur(h.blur);if(h.path&&"path"==e.type||t)l.path=z(~b(n.path).toLowerCase().indexOf("r")?a._pathToAbsolute(n.path): n.path),e._.dirty=1,"image"==e.type&&(e._.fillpos=[n.x,n.y],e._.fillsize=[n.width,n.height],u(e,1,1,0,0,0));"transform"in h&&e.transform(h.transform);q&&(v=+n.cx,t=+n.cy,q=+n.rx||+n.r||0,s=+n.ry||+n.r||0,l.path=a.format("ar{0},{1},{2},{3},{4},{1},{4},{1}x",f(21600*(v-q)),f(21600*(t-s)),f(21600*(v+q)),f(21600*(t+s)),f(21600*v)),e._.dirty=1);"clip-rect"in h&&(v=b(h["clip-rect"]).split(k),4==v.length&&(v[2]=+v[2]+ +v[0],v[3]=+v[3]+ +v[1],t=l.clipRect||a._g.doc.createElement("div"),q=t.style,q.clip=a.format("rect({1}px {2}px {3}px {0}px)", v),l.clipRect||(q.position="absolute",q.top=0,q.left=0,q.width=e.paper.width+"px",q.height=e.paper.height+"px",l.parentNode.insertBefore(t,l),t.appendChild(l),l.clipRect=t)),h["clip-rect"]||l.clipRect&&(l.clipRect.style.clip="auto"));e.textpath&&(v=e.textpath.style,h.font&&(v.font=h.font),h["font-family"]&&(v.fontFamily='"'+h["font-family"].split(",")[0].replace(/^['"]+|['"]+$/g,"")+'"'),h["font-size"]&&(v.fontSize=h["font-size"]),h["font-weight"]&&(v.fontWeight=h["font-weight"]),h["font-style"]&& (v.fontStyle=h["font-style"]));"arrow-start"in h&&A(e,h["arrow-start"]);"arrow-end"in h&&A(e,h["arrow-end"],1);if(null!=h.opacity||null!=h["stroke-width"]||null!=h.fill||null!=h.src||null!=h.stroke||null!=h["stroke-width"]||null!=h["stroke-opacity"]||null!=h["fill-opacity"]||null!=h["stroke-dasharray"]||null!=h["stroke-miterlimit"]||null!=h["stroke-linejoin"]||null!=h["stroke-linecap"]){v=(v=l.getElementsByTagName("fill"))&&v[0];!v&&(v=B("fill"));"image"==e.type&&h.src&&(v.src=h.src);h.fill&&(v.on= !0);if(null==v.on||"none"==h.fill||null===h.fill)v.on=!1;v.on&&h.fill&&((t=b(h.fill).match(a._ISURL))?(v.parentNode==l&&l.removeChild(v),v.rotate=!0,v.src=t[1],v.type="tile",q=e.getBBox(1),v.position=q.x+" "+q.y,e._.fillpos=[q.x,q.y],a._preload(t[1],function(){e._.fillsize=[this.offsetWidth,this.offsetHeight]})):(v.color=a.getRGB(h.fill).hex,v.src="",v.type="solid",a.getRGB(h.fill).error&&(e.type in{circle:1,ellipse:1}||"r"!=b(h.fill).charAt())&&L(e,h.fill,v)&&(n.fill="none",n.gradient=h.fill,v.rotate= !1)));if("fill-opacity"in h||"opacity"in h)q=((+n["fill-opacity"]+1||2)-1)*((+n.opacity+1||2)-1)*((+a.getRGB(h.fill).o+1||2)-1),q=m(g(q,0),1),v.opacity=q,v.src&&(v.color="none");l.appendChild(v);v=l.getElementsByTagName("stroke")&&l.getElementsByTagName("stroke")[0];t=!1;!v&&(t=v=B("stroke"));if(h.stroke&&"none"!=h.stroke||h["stroke-width"]||null!=h["stroke-opacity"]||h["stroke-dasharray"]||h["stroke-miterlimit"]||h["stroke-linejoin"]||h["stroke-linecap"])v.on=!0;"none"!=h.stroke&&null!==h.stroke&& null!=v.on&&0!=h.stroke&&0!=h["stroke-width"]||(v.on=!1);q=a.getRGB(h.stroke);v.on&&h.stroke&&(v.color=q.hex);q=((+n["stroke-opacity"]+1||2)-1)*((+n.opacity+1||2)-1)*((+q.o+1||2)-1);s=0.75*(d(h["stroke-width"])||1);q=m(g(q,0),1);null==h["stroke-width"]&&(s=n["stroke-width"]);h["stroke-width"]&&(v.weight=s);s&&1>s&&(q*=s)&&(v.weight=1);v.opacity=q;h["stroke-linejoin"]&&(v.joinstyle=h["stroke-linejoin"]||"miter");v.miterlimit=h["stroke-miterlimit"]||8;h["stroke-linecap"]&&(v.endcap="butt"==h["stroke-linecap"]? "flat":"square"==h["stroke-linecap"]?"square":"round");"stroke-dasharray"in h&&(q={"-":"shortdash",".":"shortdot","-.":"shortdashdot","-..":"shortdashdotdot",". ":"dot","- ":"dash","--":"longdash","- .":"dashdot","--.":"longdashdot","--..":"longdashdotdot"},v.dashstyle=q.hasOwnProperty(h["stroke-dasharray"])?q[h["stroke-dasharray"]]:"");t&&l.appendChild(v)}if("text"==e.type){e.paper.canvas.style.display="";l=e.paper.span;t=n.font&&n.font.match(/\d+(?:\.\d*)?(?=px)/);v=l.style;n.font&&(v.font=n.font); n["font-family"]&&(v.fontFamily=n["font-family"]);n["font-weight"]&&(v.fontWeight=n["font-weight"]);n["font-style"]&&(v.fontStyle=n["font-style"]);t=d(n["font-size"]||t&&t[0])||10;v.fontSize=100*t+"px";e.textpath.string&&(l.innerHTML=b(e.textpath.string).replace(/"));l=l.getBoundingClientRect();e.W=n.w=(l.right-l.left)/100;e.H=n.h=(l.bottom-l.top)/100;e.X=n.x;e.Y=n.y+e.H/2;("x"in h||"y"in h)&&(e.path.v=a.format("m{0},{1}l{2},{1}",f(21600*n.x), f(21600*n.y),f(21600*n.x)+1));l="x y text font font-family font-weight font-style font-size".split(" ");v=0;for(t=l.length;v b.styleSheets.length?b.createStyleSheet().addRule(".rvml","behavior:url(#default#VML)"):b.styleSheets[0].addRule(".rvml","behavior:url(#default#VML)");try{!b.namespaces.rvml&&b.namespaces.add("rvml","urn:schemas-microsoft-com:vml"),B=function(a){return b.createElement("')}}catch(d){B=function(a){return b.createElement("<"+a+' xmlns="urn:schemas-microsoft.com:vml" class="rvml">')}}};a._engine.initWin(a._g.win);a._engine.create=function(){var b=a._getContainer.apply(0,arguments), d=b.container,e=b.height,f=b.width,g=b.x,b=b.y;if(!d)throw Error("VML container not found.");var h=new a._Paper,m=h.canvas=a._g.doc.createElement("div"),k=m.style,g=g||0,b=b||0,f=f||512,e=e||342;h.width=f;h.height=e;f==+f&&(f+="px");e==+e&&(e+="px");h.coordsize="21600000 21600000";h.coordorigin="0 0";h.span=a._g.doc.createElement("span");h.span.style.cssText="position:absolute;left:-9999em;top:-9999em;padding:0;margin:0;line-height:1;";m.appendChild(h.span);k.cssText=a.format("top:0;left:0;width:{0};height:{1};display:inline-block;position:relative;clip:rect(0 {0} {1} 0);overflow:hidden", f,e);1==d?(a._g.doc.body.appendChild(m),k.left=g+"px",k.top=b+"px",k.position="absolute"):d.firstChild?d.insertBefore(m,d.firstChild):d.appendChild(m);h.renderfix=function(){};return h};a.prototype.clear=function(){a.eve("raphael.clear",this);this.canvas.innerHTML="";this.span=a._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};a.prototype.remove= function(){a.eve("raphael.remove",this);this.canvas.parentNode.removeChild(this.canvas);for(var b in this)this[b]="function"==typeof this[b]?a._removedFactory(b):null;return!0};var G=a.st,P;for(P in D)D.hasOwnProperty(P)&&!G.hasOwnProperty(P)&&(G[P]=function(a){return function(){var b=arguments;return this.forEach(function(d){d[a].apply(d,b)})}}(P))}})();D?G.win.Raphael=a:Raphael=a;"object"==typeof exports&&(module.exports=a);return a});var TGOS=TGOS||{};TGOS.MVCObject=function(){this.binds_=[];this.events_=[]};TGOS.MVCObject.prototype.addListener=function(b,d){};TGOS.MVCObject.prototype.bindTo=function(b,d,a,f){f={key:b,target:d,targetKey:a?a:b,noNotify:f?!0:!1,eventName:b+"_changed"};this.binds_.push(f);this[b]!==f.target[f.targetKey]&&(f.target[f.targetKey]=this[b],this.notify_(d,a))};TGOS.MVCObject.prototype.changed=function(b){};TGOS.MVCObject.prototype.get=function(b){return this[b]}; TGOS.MVCObject.prototype.notifyAll=function(b){this.notify_(this,b);for(var d=0;da?2*a*a:-1+(4-2*a)*a},cubicIn:function(a){return a*a*a},cubicOut:function(a){return--a* a*a+1},cubicInOut:function(a){return 0.5>a?4*a*a*a:(a-1)*(2*a-2)*(2*a-2)+1},quartIn:function(a){return a*a*a*a},quartOut:function(a){return 1- --a*a*a*a},quartInOut:function(a){return 0.5>a?8*a*a*a*a:1-8*--a*a*a*a},quintIn:function(a){return a*a*a*a*a},quintOut:function(a){return 1+--a*a*a*a*a},quintInOut:function(a){return 0.5>a?16*a*a*a*a*a:1+16*--a*a*a*a*a}};b.createAnimation=function(f){var e=f.easing?f.easing:b.easing.linear,g="number"==typeof f.duration?f.duration:350,h="function"==typeof f.onAnimation? f.onAnimation:null,k="function"==typeof f.onEnd?f.onEnd:null,l="function"==typeof f.onStart?f.onStart:null,p=f.type?f.type:"setTimeout",m="boolean"==typeof f.repeat?f.repeat:!1,n=f.rate?f.rate:20,u=f.delay?f.delay:0,s,q=null,w,C=!1,B=function(a){if(!C){null===q&&(l&&l.call(this),q="setTimeout"==p?new Date:a);w="setTimeout"==p?new Date:a;var b="setTimeout"==p?Math.abs(w.getTime()-q.getTime()):Math.abs(a-q);percent=e(b/g);h&&h.call(this,percent);1>percent&&bl;l++)if(!d||2!=l||void 0!==a.z)switch(0==l?(h=f,k="x"):1==l?(h=e,k="y"):(h=g,k="z"),b.axis[l]){case "e":a[k]=h;break;case "w":a[k]=-h;break;case "n":a[k]=h;break;case "s":a[k]=-h;break;case "u":void 0!==a[k]&&(a.z=h);break;case "d":void 0!==a[k]&&(a.z=-h);break;default:return alert("ERROR: unknow axis ("+ b.axis[l]+") - check definition of "+b.projName),null}return a},reportError:function(){},extend:function(b,d){b=b||{};if(d)for(var a in d){var f=d[a];void 0!==f&&(b[a]=f)}return b},Class:function(){for(var b=function(){this.initialize.apply(this,arguments)},d={},a,f=0;f=g;g++)if(f=b*Math.sin(e),f=this.HALF_PI-2*Math.atan(d*Math.pow((1-f)/(1+f),a))-e,e+=f,1E-10>=Math.abs(f))return e;alert("phi2z has NoConvergence");return-9999},qsfnz:function(b,d){var a;return 1E-7b?-1:1},adjust_lon:function(b){return Math.abs(b)this.HALF_PI)return+Number.NaN;if(d==this.HALF_PI)return Number.POSITIVE_INFINITY;if(d==-1*this.HALF_PI)return-1*Number.POSITIVE_INFINITY;a*=b;return Math.log(Math.tan((this.HALF_PI+d)/2))+b*Math.log((1-a)/(1+a))/2},fL:function(b,d){return 2*Math.atan(b*Math.exp(d))-this.HALF_PI},invlatiso:function(b,d){var a=this.fL(1,d),f=0,e=0;do f=a,e=b*Math.sin(f),a=this.fL(Math.exp(b*Math.log((1+e)/(1-e))/2),d);while(1E-12-1.001*Proj4js.common.HALF_PI)a=-Proj4js.common.HALF_PI;else if(a>Proj4js.common.HALF_PI&&a<1.001*Proj4js.common.HALF_PI)a=Proj4js.common.HALF_PI;else if(a<-Proj4js.common.HALF_PI||a>Proj4js.common.HALF_PI)return Proj4js.reportError("geocent:lat out of range:"+a),null;d>Proj4js.common.PI&&(d-=2*Proj4js.common.PI);g=Math.sin(a);h=Math.cos(a);e=this.a/Math.sqrt(1-this.es*g*g);a=(e+f)*h*Math.cos(d); d=(e+f)*h*Math.sin(d);f=(e*(1-this.es)+f)*g;b.x=a;b.y=d;b.z=f;return 0},geocentric_to_geodetic:function(b){var d,a,f,e,g,h,k,l,p,m,n=b.x;f=b.y;var u=b.z?b.z:0;d=Math.sqrt(n*n+f*f);a=Math.sqrt(n*n+f*f+u*u);if(1E-12>d/this.a){if(n=0,1E-12>a/this.a)return}else n=Math.atan2(f,n);f=u/a;e=d/a;g=1/Math.sqrt(1-this.es*(2-this.es)*e*e);k=e*(1-this.es)*g;l=f*g;m=0;do m++,h=this.a/Math.sqrt(1-this.es*l*l),a=d*k+u*l-h*(1-this.es*l*l),h=this.es*h/(h+a),g=1/Math.sqrt(1-h*(2-h)*e*e),h=e*(1-h)*g,g*=f,p=g*k-h*l,k= h,l=g;while(1E-24m);d=Math.atan(g/Math.abs(h));b.x=n;b.y=d;b.z=a;return b},geocentric_to_geodetic_noniter:function(b){var d=b.x,a=b.y,f=b.z?b.z:0,e,g,h,k,l,d=parseFloat(d),a=parseFloat(a),f=parseFloat(f);l=!1;if(0!=d)e=Math.atan2(a,d);else if(0a)e=-Proj4js.common.HALF_PI;else if(l=!0,e=0,0f)g=-Proj4js.common.HALF_PI;else return;h=d*d+a*a;d=Math.sqrt(h);a=f*Proj4js.common.AD_C;h=Math.sqrt(a*a+h);a/=h;h=d/h;a=f+this.b* this.ep2*a*a*a;k=d-this.a*this.es*h*h*h;h=Math.sqrt(a*a+k*k);a/=h;h=k/h;k=this.a/Math.sqrt(1-this.es*a*a);f=h>=Proj4js.common.COS_67P5?d/h-k:h<=-Proj4js.common.COS_67P5?d/-h-k:f/a+k*(this.es-1);!1==l&&(g=Math.atan(a/h));b.x=e;b.y=g;b.z=f;return b},geocentric_to_wgs84:function(b){if(this.datum_type==Proj4js.common.PJD_3PARAM)b.x+=this.datum_params[0],b.y+=this.datum_params[1],b.z+=this.datum_params[2];else if(this.datum_type==Proj4js.common.PJD_7PARAM){var d=this.datum_params[3],a=this.datum_params[4], f=this.datum_params[5],e=this.datum_params[6],g=e*(f*b.x+b.y-d*b.z)+this.datum_params[1],d=e*(-a*b.x+d*b.y+b.z)+this.datum_params[2];b.x=e*(b.x-f*b.y+a*b.z)+this.datum_params[0];b.y=g;b.z=d}},geocentric_from_wgs84:function(b){if(this.datum_type==Proj4js.common.PJD_3PARAM)b.x-=this.datum_params[0],b.y-=this.datum_params[1],b.z-=this.datum_params[2];else if(this.datum_type==Proj4js.common.PJD_7PARAM){var d=this.datum_params[3],a=this.datum_params[4],f=this.datum_params[5],e=this.datum_params[6],g=(b.x- this.datum_params[0])/e,h=(b.y-this.datum_params[1])/e,e=(b.z-this.datum_params[2])/e;b.x=g+f*h-a*e;b.y=-f*g+h+d*e;b.z=a*g-d*h+e}}}); Proj4js.Point=Proj4js.Class({initialize:function(b,d,a){"object"==typeof b?(this.x=b[0],this.y=b[1],this.z=b[2]||0):"string"==typeof b&&"undefined"==typeof d?(b=b.split(","),this.x=parseFloat(b[0]),this.y=parseFloat(b[1]),this.z=parseFloat(b[2])||0):(this.x=b,this.y=d,this.z=a||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(b){var d=b.x,a=b.y;this.sin_phi=Math.sin(a);this.cos_phi=Math.cos(a);var a=Proj4js.common.qsfnz(this.e3,this.sin_phi,this.cos_phi),a=this.a*Math.sqrt(this.c-this.ns0*a)/this.ns0,f=this.ns0*Proj4js.common.adjust_lon(d-this.long0),d=a*Math.sin(f)+this.x0,a=this.rh-a*Math.cos(f)+this.y0;b.x=d;b.y=a;return b},inverse:function(b){var d,a,f;b.x-=this.x0;b.y=this.rh-b.y+this.y0;0<=this.ns0?(d=Math.sqrt(b.x*b.x+b.y*b.y),a=1):(d=-Math.sqrt(b.x*b.x+b.y*b.y),a=-1);f=0;0!=d&&(f=Math.atan2(a* b.x,a*b.y));a=d*this.ns0/this.a;d=(this.c-a*a)/this.ns0;1E-10<=this.e3?(a=1-0.5*(1-this.es)*Math.log((1-this.e3)/(1+this.e3))/this.e3,a=1E-10=l;l++)if(a=Math.sin(h),f=Math.cos(h), e=b*a,g=1-e*e,a=0.5*g*g/f*(d/(1-k)-a/g+0.5/b*Math.log((1-e)/(1+e))),h+=a,1E-7>=Math.abs(a))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(b){var d,a,f,e;b.x=Proj4js.common.adjust_lon(b.x-this.long0);Proj4js.Proj.gauss.forward.apply(this,[b]);d=Math.sin(b.y);a=Math.cos(b.y);f=Math.cos(b.x);e=this.k0*this.R2/(1+this.sinc0*d+this.cosc0* a*f);b.x=e*a*Math.sin(b.x);b.y=e*(this.cosc0*d-this.sinc0*a*f);b.x=this.a*b.x+this.x0;b.y=this.a*b.y+this.y0;return b},inverse:function(b){var d,a,f,e;b.x=(b.x-this.x0)/this.a;b.y=(b.y-this.y0)/this.a;b.x/=this.k0;b.y/=this.k0;(e=Math.sqrt(b.x*b.x+b.y*b.y))?(f=2*Math.atan2(e,this.R2),d=Math.sin(f),a=Math.cos(f),f=Math.asin(a*this.sinc0+b.y*d*this.cosc0/e),d=Math.atan2(b.x*d,e*this.cosc0*a-b.y*this.sinc0*d)):(f=this.phic0,d=0);b.x=d;b.y=f;Proj4js.Proj.gauss.inverse.apply(this,[b]);b.x=Proj4js.common.adjust_lon(b.x+ this.long0);return b}};function phi4z(b,d,a,f,e,g,h,k,l){var p,m,n,u,s,q;l=g;for(q=1;15>=q;q++)if(p=Math.sin(l),n=Math.tan(l),k=n*Math.sqrt(1-b*p*p),m=Math.sin(2*l),u=d*l-a*m+f*Math.sin(4*l)-e*Math.sin(6*l),s=d-2*a*Math.cos(2*l)+4*f*Math.cos(4*l)-6*e*Math.cos(6*l),p=2*u+k*(u*u+h)-2*g*(k*u+1),n=b*m*(u*u+h-2*g*u)/(2*k),k=2*(g-u)*(k*s-2/m)-2*s,p/=n+k,l+=p,1E-10>=Math.abs(p))return l;Proj4js.reportError("phi4z: No convergence");return null} function e4fn(b){var d;d=1+b;b=1-b;return Math.sqrt(Math.pow(d,d)*Math.pow(b,b))} 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(b){var d,a,f,e,g;f=b.y;a=Proj4js.common.adjust_lon(b.x-this.long0);1E-7>=Math.abs(f)?(g=this.x0+this.a*a,d=this.y0-this.a* this.ml0):(d=Math.sin(f),a=Math.cos(f),f=Proj4js.common.mlfn(this.e0,this.e1,this.e2,this.e3,f),e=Proj4js.common.msfnz(this.e,d,a),a=d,g=this.x0+this.a*e*Math.sin(a)/d,d=this.y0+this.a*(f-this.ml0+e*(1-Math.cos(a))/d));b.x=g;b.y=d;return b},inverse:function(b){var d,a;b.x-=this.x0;b.y-=this.y0;d=this.ml0+b.y/this.a;if(1E-7>=Math.abs(d))d=b.x/this.a+this.long0,a=0;else{d=d*d+b.x/this.a*(b.x/this.a);d=phi4z(this.es,this.e0,this.e1,this.e2,this.e3,this.al,d,void 0,a);if(1!=d)return d;d=Proj4js.common.adjust_lon(Proj4js.common.asinz(NaN* b.x/this.a)/Math.sin(a)+this.long0)}b.x=d;b.y=a;return b}}; 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(b){var d=b.y,a=this.x0+this.a*Proj4js.common.adjust_lon(b.x-this.long0)*Math.cos(this.lat0),d=this.y0+this.a*d;this.t1=a;this.t2=Math.cos(this.lat0);b.x=a;b.y=d;return b},inverse:function(b){b.x-=this.x0;b.y-=this.y0;var d=b.y/this.a;Math.abs(d)>Proj4js.common.HALF_PI&&Proj4js.reportError("equi:Inv:DataError");var a=Proj4js.common.adjust_lon(this.long0+ b.x/(this.a*Math.cos(this.lat0)));b.x=a;b.y=d}}; 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(b){var d=b.x,a=b.y;if(90a*Proj4js.common.R2D&&180d*Proj4js.common.R2D)return Proj4js.reportError("merc:forward: llInputOutOfRange: "+d+" : "+a),null;if(Math.abs(Math.abs(a)-Proj4js.common.HALF_PI)<=Proj4js.common.EPSLN)return Proj4js.reportError("merc:forward: ll2mAtPoles"),null; if(this.sphere)d=this.x0+this.a*this.k0*Proj4js.common.adjust_lon(d-this.long0),a=this.y0+this.a*this.k0*Math.log(Math.tan(Proj4js.common.FORTPI+0.5*a));else var f=Math.sin(a),a=Proj4js.common.tsfnz(this.e,a,f),d=this.x0+this.a*this.k0*Proj4js.common.adjust_lon(d-this.long0),a=this.y0-this.a*this.k0*Math.log(a);b.x=d;b.y=a;return b},inverse:function(b){var d=b.x-this.x0,a=b.y-this.y0;if(this.sphere)a=Proj4js.common.HALF_PI-2*Math.atan(Math.exp(-a/this.a*this.k0));else if(a=Math.exp(-a/(this.a*this.k0)), a=Proj4js.common.phi2z(this.e,a),-9999==a)return Proj4js.reportError("merc:inverse: lat = -9999"),null;d=Proj4js.common.adjust_lon(this.long0+d/(this.a*this.k0));b.x=d;b.y=a;return b}};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=0.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(b){var d=b.x,a=this.a*(this.g-Proj4js.common.mlfn(this.e0,this.e1,this.e2,this.e3,b.y)),f=this.ns*Proj4js.common.adjust_lon(d-this.long0),d=this.x0+a*Math.sin(f),a=this.y0+this.rh-a*Math.cos(f);b.x=d;b.y=a;return b},inverse:function(b){b.x-=this.x0;b.y=this.rh-b.y+this.y0;var d,a;0<=this.ns?(a=Math.sqrt(b.x*b.x+b.y*b.y),d=1):(a=-Math.sqrt(b.x*b.x+b.y*b.y),d=-1);var f=0;0!=a&&(f=Math.atan2(d*b.x,d*b.y));d=this.phi3z(this.g- a/this.a,this.e0,this.e1,this.e2,this.e3);f=Proj4js.common.adjust_lon(this.long0+f/this.ns);b.x=f;b.y=d;return b},phi3z:function(b,d,a,f,e){var g,h;g=b;for(var k=0;15>k;k++)if(h=(b+a*Math.sin(2*g)-f*Math.sin(4*g)+e*Math.sin(6*g))/d-g,g+=h,1E-10>=Math.abs(h))return g;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(b){var d=b.y,a=Proj4js.common.adjust_lon(b.x-this.long0),f,e;f=Math.sin(d);var g=Math.cos(d);if(this.sphere){var h=g*Math.sin(a);if(1E-10>Math.abs(Math.abs(h)-1))return Proj4js.reportError("tmerc:forward: Point projects into infinity"), 93;e=0.5*this.a*this.k0*Math.log((1+h)/(1-h));f=Math.acos(g*Math.cos(a)/Math.sqrt(1-h*h));0>d&&(f=-f);d=this.a*this.k0*(f-this.lat0)}else{e=g*a;var a=Math.pow(e,2),g=this.ep2*Math.pow(g,2),h=Math.tan(d),k=Math.pow(h,2);f=1-this.es*Math.pow(f,2);f=this.a/Math.sqrt(f);d=this.a*Proj4js.common.mlfn(this.e0,this.e1,this.e2,this.e3,d);e=this.k0*f*e*(1+a/6*(1-k+g+a/20*(5-18*k+Math.pow(k,2)+72*g-58*this.ep2)))+this.x0;d=this.k0*(d-this.ml0+f*h*a*(0.5+a/24*(5-k+9*g+4*Math.pow(g,2)+a/30*(61-58*k+Math.pow(k, 2)+600*g-330*this.ep2))))+this.y0}b.x=e;b.y=d;return b},inverse:function(b){var d,a,f,e;if(this.sphere){a=Math.exp(b.x/(this.a*this.k0));var g=0.5*(a-1/a);f=this.lat0+b.y/(this.a*this.k0);e=Math.cos(f);d=Math.sqrt((1-e*e)/(1+g*g));a=Proj4js.common.asinz(d);0>f&&(a=-a);d=0==g&&0==e?this.long0:Proj4js.common.adjust_lon(Math.atan2(g,e)+this.long0)}else{var g=b.x-this.x0,h=b.y-this.y0;a=d=(this.ml0+h/this.k0)/this.a;for(e=0;;e++){f=(d+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");a=Proj4js.common.asinz(d/this.a);f=Math.sin(a);e=Math.cos(a);a=this.long0;Math.abs(d);f=Proj4js.common.asinz(e*this.sin_p14+b.y*f*this.cos_p14/d);d=Math.abs(this.lat0)-Proj4js.common.HALF_PI;Math.abs(d)<=Proj4js.common.EPSLN&&(a=0<=this.lat0?Proj4js.common.adjust_lon(this.long0+Math.atan2(b.x,-b.y)):Proj4js.common.adjust_lon(this.long0-Math.atan2(-b.x,b.y)));Math.sin(f);b.x=a;b.y=f;return b}}; Proj4js.Proj.krovak={init:function(){this.a=6377397.155;this.es=0.006674372230614;this.e=Math.sqrt(this.es);this.lat0||(this.lat0=0.863937979737193);this.long0||(this.long0=0.4334234309119251);this.k0||(this.k0=0.9999);this.s45=0.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(b){var d,a,f;a=b.y;f=Proj4js.common.adjust_lon(b.x-this.long0);d=Math.pow((1+this.e*Math.sin(a))/(1-this.e*Math.sin(a)),this.alfa* this.e/2);d=2*(Math.atan(this.k*Math.pow(Math.tan(a/2+this.s45),this.alfa)/d)-this.s45);a=-f*this.alfa;f=Math.asin(Math.cos(this.ad)*Math.sin(d)+Math.sin(this.ad)*Math.cos(d)*Math.cos(a));d=this.n*Math.asin(Math.cos(d)*Math.sin(a)/Math.cos(f));f=this.ro0*Math.pow(Math.tan(this.s0/2+this.s45),this.n)/Math.pow(Math.tan(f/2+this.s45),this.n);b.y=f*Math.cos(d)/1;b.x=f*Math.sin(d)/1;this.czech&&(b.y*=-1,b.x*=-1);return b},inverse:function(b){var d,a,f;d=b.x;b.x=b.y;b.y=d;this.czech&&(b.y*=-1,b.x*=-1); d=Math.sqrt(b.x*b.x+b.y*b.y);a=Math.atan2(b.y,b.x)/Math.sin(this.s0);f=2*(Math.atan(Math.pow(this.ro0/d,1/this.n)*Math.tan(this.s0/2+this.s45))-this.s45);d=Math.asin(Math.cos(this.ad)*Math.sin(f)-Math.sin(this.ad)*Math.cos(f)*Math.cos(a));a=Math.asin(Math.cos(f)*Math.sin(a)/Math.cos(d));b.x=this.long0-a/this.alfa;a=d;var e=f=0;do b.y=2*(Math.atan(Math.pow(this.k,-1/this.alfa)*Math.pow(Math.tan(d/2+this.s45),1/this.alfa)*Math.pow((1+this.e*Math.sin(a))/(1-this.e*Math.sin(a)),this.e/2))-this.s45),1E-10> Math.abs(a-b.y)&&(f=1),a=b.y,e+=1;while(0==f&&15>e);return 15<=e?(Proj4js.reportError("PHI3Z-CONV:Latitude failed to converge after 15 iterations"),null):b}}; Proj4js.Proj.somerc={init:function(){var b=this.lat0;this.lambda0=this.long0;var d=Math.sin(b),a=this.a,f=1/this.rf,f=2*f-Math.pow(f,2),e=this.e=Math.sqrt(f);this.R=this.k0*a*Math.sqrt(1-f)/(1-f*Math.pow(d,2));this.alpha=Math.sqrt(1+f/(1-f)*Math.pow(Math.cos(b),4));this.b0=Math.asin(d/this.alpha);this.K=Math.log(Math.tan(Math.PI/4+this.b0/2))-this.alpha*Math.log(Math.tan(Math.PI/4+b/2))+this.alpha*e/2*Math.log((1+e*d)/(1-e*d))},forward:function(b){var d=Math.log(Math.tan(Math.PI/4-b.y/2)),a=this.e/ 2*Math.log((1+this.e*Math.sin(b.y))/(1-this.e*Math.sin(b.y))),a=2*(Math.atan(Math.exp(-this.alpha*(d+a)+this.K))-Math.PI/4),f=this.alpha*(b.x-this.lambda0),d=Math.atan(Math.sin(f)/(Math.sin(this.b0)*Math.tan(a)+Math.cos(this.b0)*Math.cos(f))),a=Math.asin(Math.cos(this.b0)*Math.sin(a)-Math.sin(this.b0)*Math.cos(a)*Math.cos(f));b.y=this.R/2*Math.log((1+Math.sin(a))/(1-Math.sin(a)))+this.y0;b.x=this.R*d+this.x0;return b},inverse:function(b){for(var d=(b.x-this.x0)/this.R,a=2*(Math.atan(Math.exp((b.y- this.y0)/this.R))-Math.PI/4),f=Math.asin(Math.cos(this.b0)*Math.sin(a)+Math.sin(this.b0)*Math.cos(a)*Math.cos(d)),d=this.lambda0+Math.atan(Math.sin(d)/(Math.cos(this.b0)*Math.cos(d)-Math.sin(this.b0)*Math.tan(a)))/this.alpha,e=f,g=-1E3,h=0;1E-7this.lat0?this.S_POLE:this.N_POLE:b>Proj4js.common.EPSLN?this.OBLIQ:this.EQUIT;this.phits=Math.abs(this.phits);if(this.es){var d;switch(this.mode){case this.N_POLE:case this.S_POLE:Math.abs(this.phits- Proj4js.common.HALF_PI)=Proj4js.common.EPSLN?Math.cos(this.phits)/Math.tan(Proj4js.common.FORTPI-0.5*this.phits):2*this.k0}},forward:function(b){var d=b.x,d=Proj4js.common.adjust_lon(d-this.long0),a=b.y,f,e;if(this.sphere){var g,h,k;g=Math.sin(a);h=Math.cos(a); k=Math.cos(d);d=Math.sin(d);switch(this.mode){case this.EQUIT:e=1+h*k;e<=Proj4js.common.EPSLN&&Proj4js.reportError("stere:forward:Equit");e=this.akm1/e;f=e*h*d;e*=g;break;case this.OBLIQ:e=1+this.sinph0*g+this.cosph0*h*k;e<=Proj4js.common.EPSLN&&Proj4js.reportError("stere:forward:Obliq");e=this.akm1/e;f=e*h*d;e*=this.cosph0*g-this.sinph0*h*k;break;case this.N_POLE:k=-k,a=-a;case this.S_POLE:Math.abs(a-Proj4js.common.HALF_PI)=g;g++)f*=d,e+=this.A[g]*f;for(var d=e,f=1,h=0,k=0,l=0,g=1;6>=g;g++)e=f*d-h*a,h=h*d+f*a,f=e,k=k+this.B_re[g]*f-this.B_im[g]*h,l=l+this.B_im[g]*f+this.B_re[g]*h;b.x=l*this.a+this.x0;b.y=k*this.a+this.y0;return b},inverse:function(b){for(var d=(b.y-this.y0)/this.a,a=(b.x-this.x0)/this.a,f=1,e=0,g,h=0,k=0,l=1;6>=l;l++)g= f*d-e*a,e=e*d+f*a,f=g,h=h+this.C_re[l]*f-this.C_im[l]*e,k=k+this.C_im[l]*f+this.C_re[l]*e;for(f=0;f=l;l++)n=p*h-m*k,m=m*h+p*k,p=n,g+=(l-1)*(this.B_re[l]*p-this.B_im[l]*m),e+=(l-1)*(this.B_im[l]*p+this.B_re[l]*m);for(var p=1,m=0,u=this.B_re[1],s=this.B_im[1],l=2;6>=l;l++)n=p*h-m*k,m=m*h+p*k,p=n,u+=l*(this.B_re[l]*p-this.B_im[l]*m),s+=l*(this.B_im[l]*p+this.B_re[l]*m);k=u*u+s*s;h=(g*u+e*s)/k;k=(e*u-g*s)/k}d=h;a=1;h=0;for(l=1;9>=l;l++)a*=d,h+=this.D[l]* a;l=this.lat0+1E5*h*Proj4js.common.SEC_TO_RAD;b.x=this.long0+k;b.y=l;return b}};Proj4js.Proj.mill={init:function(){},forward:function(b){var d=b.y,a=this.x0+this.a*Proj4js.common.adjust_lon(b.x-this.long0),d=this.y0+1.25*this.a*Math.log(Math.tan(Proj4js.common.PI/4+d/2.5));b.x=a;b.y=d;return b},inverse:function(b){b.x-=this.x0;b.y-=this.y0;var d=Proj4js.common.adjust_lon(this.long0+b.x/this.a),a=2.5*(Math.atan(Math.exp(0.8*b.y/this.a))-Proj4js.common.PI/4);b.x=d;b.y=a;return b}}; 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(b){var d,a,f,e,g;a=b.y;f=Proj4js.common.adjust_lon(b.x-this.long0);d=Math.sin(a);a=Math.cos(a);e=Math.cos(f);g=this.sin_p14*d+this.cos_p14*a*e;0a&&(g=-g);a=this.x0+g;g=Math.abs(g/(Proj4js.common.PI*this.R));d=0<=d?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);b.x=a;b.y=d;return b},inverse:function(b){var d,a,f,e,g,h,k,l;b.x-=this.x0;b.y-=this.y0;l=Proj4js.common.PI*this.R;d=b.x/l;f=b.y/l;e=d*d+f*f;g=-Math.abs(f)*(1+e);a=g-2*f*f+d*d;h=-2*g+1+2*f*f+e*e;l=f*f/h+(2*a*a*a/h/h/h-9*g*a/h/h)/27;k=(g-a*a/3/h)/h;g=2*Math.sqrt(-k/3);l=3*l/k/g;1Math.abs(a-b.y))break;b.y=a}if(!e)return Proj4js.reportError("gauss:inverse:convergence failed"),null;b.x=d;b.y=a;return b}}; 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 b=1-Math.pow(this.b/this.a,2);Math.sqrt(b);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-b);this.bl=Math.sqrt(1+this.es*Math.pow(this.cos_p20,4)/(1-b));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=0.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=0.5*(this.lon1+this.lon2)-Math.atan(this.j*Math.tan(0.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(b){var d,a,f,e,g;f=b.x;a=b.y;d=Math.sin(a);e=Proj4js.common.adjust_lon(f-this.longc); f=Math.sin(this.bl*e);Math.abs(Math.abs(a)-Proj4js.common.HALF_PI)>Proj4js.common.EPSLN?(d=Proj4js.common.tsfnz(this.e,a,d),d=this.el/Math.pow(d,this.bl),g=0.5*(d-1/d),d=(g*this.singam-f*this.cosgam)/(0.5*(d+1/d)),a=Math.cos(this.bl*e),1E-7>Math.abs(a)?f=this.al*this.bl*e:(f=this.al*Math.atan((g*this.cosgam+f*this.singam)/a)/this.bl,0>a&&(f+=Proj4js.common.PI*this.al/this.bl))):(d=0<=a?this.singam:-this.singam,f=this.al*a/this.bl);Math.abs(Math.abs(d)-1)<=Proj4js.common.EPSLN&&Proj4js.reportError("omercFwdInfinity"); e=0.5*this.al*Math.log((1-d)/(1+d))/this.bl;f-=this.u;d=this.y0+f*this.cosaz-e*this.sinaz;b.x=this.x0+e*this.cosaz+f*this.sinaz;b.y=d;return b},inverse:function(b){var d,a,f,e;b.x-=this.x0;b.y-=this.y0;d=b.x*this.cosaz-b.y*this.sinaz;f=b.y*this.cosaz+b.x*this.sinaz;f+=this.u;a=Math.exp(-this.bl*d/this.al);d=0.5*(a-1/a);a=0.5*(a+1/a);f=Math.sin(this.bl*f/this.al);e=(f*this.cosgam+d*this.singam)/a;Math.abs(Math.abs(e)-1)<=Proj4js.common.EPSLN?(d=this.longc,e=0<=e?Proj4js.common.HALF_PI:-Proj4js.common.HALF_PI): (a=1/this.bl,e=Math.pow(this.el/Math.sqrt((1+e)/(1-e)),a),e=Proj4js.common.phi2z(this.e,e),d=this.longc-Math.atan2(d*this.cosgam-f*this.singam,a)/this.bl,d=Proj4js.common.adjust_lon(d));b.x=d;b.y=e;return b}}; 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(d/e)/Math.log(a/f):b;this.f0=d/(this.ns*Math.pow(a,this.ns));this.rh=this.a*this.f0*Math.pow(g,this.ns);this.title||(this.title="Lambert Conformal Conic")}},forward:function(b){var d=b.x,a=b.y;if(!(90>=a&&-90<=a&&180>=d&&-180<=d))return Proj4js.reportError("lcc:forward: llInputOutOfRange: "+d+" : "+a),null;var f=Math.abs(Math.abs(a)-Proj4js.common.HALF_PI);if(f>Proj4js.common.EPSLN)a=Proj4js.common.tsfnz(this.e, a,Math.sin(a)),a=this.a*this.f0*Math.pow(a,this.ns);else{f=a*this.ns;if(0>=f)return Proj4js.reportError("lcc:forward: No Projection"),null;a=0}d=this.ns*Proj4js.common.adjust_lon(d-this.long0);b.x=this.k0*a*Math.sin(d)+this.x0;b.y=this.k0*(this.rh-a*Math.cos(d))+this.y0;return b},inverse:function(b){var d,a,f,e=(b.x-this.x0)/this.k0,g=this.rh-(b.y-this.y0)/this.k0;0this.lat0?this.S_POLE:this.N_POLE:Math.abs(b)h){Proj4js.reportError("aeqd:Fwd:PointError");return}}else a=Math.acos(h),a/=Math.sin(a);b.x=this.x0+this.a*a*e*Math.sin(d);b.y=this.y0+this.a*a*(this.cos_p12*f-this.sin_p12*e*g);return b}, inverse:function(b){b.x-=this.x0;b.y-=this.y0;var d=Math.sqrt(b.x*b.x+b.y*b.y);if(d>2*Proj4js.common.HALF_PI*this.a)Proj4js.reportError("aeqdInvDataError");else{var a=d/this.a,f=Math.sin(a),a=Math.cos(a),e=this.long0,g;if(Math.abs(d)<=Proj4js.common.EPSLN)g=this.lat0;else{g=Proj4js.common.asinz(a*this.sin_p12+b.y*f*this.cos_p12/d);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(b.x,-b.y)):Proj4js.common.adjust_lon(this.long0- Math.atan2(-b.x,b.y)):(h=a-this.sin_p12*Math.sin(g),Math.abs(h)Proj4js.common.PI&&(a=Proj4js.common.PI);d=(2*d+Math.sin(2*d))/Proj4js.common.PI;1w?0:Math.floor((w-f)/D)-1;D=w+Math.ceil(Math.abs(h-f)/D);idxRange={lowerX:A,upperX:B,lowerY:w,upperY:D};for(D=idxRange.lowerY;Dd/2)){var f=G.TileMatrix[e].TopLeftCorner,v=parseFloat(f.split(" ")[0]),t=parseFloat(f.split(" ")[1]),f=u.FromMapPoint(v,t),q=u.ToMapPoint(0,0),E=u.ToMapPoint(u.getClientWidth(),u.getClientHeight()),p,D,U,Y,M;p=q.xt?0:Math.floor((t-h)/d);Y=U+Math.ceil(Math.abs(l-h)/d);M=q.xt?0:Math.floor((t- q.y)/d);q=t+Math.ceil(Math.abs(E.y-q.y)/d);d=Math.max(M,p);D=Math.min(v,D);t=Math.max(t,U);Y=Math.min(q,Y);if(w!=d||C!=D||B!=t||H!=Y||e!=I){w=d;C=D;B=t;H=Y;I=e;parseFloat(G.TileMatrix[e].MatrixWidth);parseFloat(G.TileMatrix[e].MatrixHeight);var N;U=[];q=p=0;for(E=t;E<=Y;E++){U.push([]);for(M=d;M<=D;M++)v=f.x+256*M,t=f.y+256*E,N=document.createElement("img"),N.style.display="none",N.onload=function(){var a=this,b=0;a.style.opacity=b;var d=A/7,e=setInterval(function(){b>=A?(N.style.filter="alpha(opacity="+ 100*A+")",a.style.opacity=A,clearInterval(e)):(a.style.opacity=b,a.style.filter="alpha(opacity="+100*b+")",b+=d)},33);a.style.filter="alpha(opacity=0)";this.style.display="block"},N.xIdx=M,N.yIdx=E,N.style.position="absolute",N.style.left=v+"px",N.style.top=t+"px",N.galleryImg=!1,N.hideFocus=!0,N.style.MozUserSelect="none",N.border="0px",U[q].push(N),N.src=b+"?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&Layer="+a.layer+"&Style=default&Format=image/png&TileMatrixSet="+a.matrixSet+"&TileMatrix="+G.TileMatrix[e]["ows:Identifier"]+ "&TileRow="+E+"&TileCol="+M,n.appendChild(N),N.style.opacity=A,N.style.filter="alpha(opacity="+100*A+")",p++;q++}if(0 C.indexOf("3826")&&(0<=C.indexOf("3825")?(d=TGOS.TWD97toTWD97_119(d.x,d.y),e=TGOS.TWD97toTWD97_119(e.x,e.y)):0<=C.indexOf("4326")&&(d=TGOS.TWD97toWGS84(d.x,d.y),e=TGOS.TWD97toWGS84(e.x,e.y)));break;case TGOS.TGCoordSys.EPSG3825:0>C.indexOf("3825")&&(0<=C.indexOf("3826")?(d=TGOS.TWD97_119toTWD97(d.x,d.y),e=TGOS.TWD97_119toTWD97(e.x,e.y)):0<=C.indexOf("4326")&&(d=TGOS.TWD97_119toWGS84(d.x,d.y),e=TGOS.TWD97_119toWGS84(e.x,e.y)))}var f=d.x,n=e.y,q=e.x,p=d.y;"1.3.0"==w&&0>C.indexOf("CRS:84")&&0<=C.indexOf("EPSG:4326")&& (f=e.y,n=d.x,q=d.y,p=e.x);a=h+"?BBOX="+(f+","+n+","+q+","+p)+"&WIDTH="+a+"&HEIGHT="+b+"&SIZE="+a+","+b;a+="&"+B.join("&");m&&(a=m+"?"+a);return a}}function g(){if(l){var a=k.getClientWidth(),b=k.getClientHeight(),d=k.ToMapPoint(0,0),e=k.ToMapPoint(a,b);console.log(d);console.log(e);return{left:d.x,top:d.y,right:e.x,bottom:e.y,width:a,height:b}}}var h,k,l=null,p=!0,m,n="auto",u,s=1,l=a.map,q=l.getPanes().overlayviewLayer;a&&(void 0!==a.opacity&&"number"==typeof a.opacity&&(s=a.opacity),void 0!==a.visible&& "boolean"==typeof a.visible&&(p=a.visible),void 0!==a.zIndex&&"number"==typeof a.zIndex&&(n=a.zIndex),void 0!==a.container&&(q=a.container),void 0!==a.proxy&&(m=0a?d=q.firstChild:a>=b||(d=q.childNodes[a]));q.removeChild(layerContainer);d?q.insertBefore(layerContainer,d):q.appendChild(layerContainer)}};this.RemoveSelf= function(){q&&A&&q.removeChild(A)};this.getLayerId=function(){return layerID};this.getNode=function(){return A};this.getDefaultViewport=function(){};this.getUrl=function(){return h};this.removeWmsLayer=function(){l.removeLayer(this)};this.getZIndex=function(){return n};this.setZIndex=function(a){n=a;A&&(A.style.zIndex=n)};this.getWmsVisible=function(){return this.getVisible()};this.getVisible=function(){return p};this.setWmsVisible=function(a){this.setVisible(a)};this.setVisible=function(a){p=a;A&& (A.style.display=p?"block":"none")};this.putVisible=function(a){this.setVisible(a)};this.setProxy=function(a){a&&(m=0a.x?a.x=0:a.x>n.getClientWidth()&& (a.x=n.getClientWidth());0>a.y?a.y=0:a.y>n.getClientHeight()&&(a.y=n.getClientHeight());0>b.x?b.x=0:b.x>n.getClientWidth()&&(b.x=n.getClientWidth());0>b.y?b.y=0:b.y>n.getClientHeight()&&(b.y=n.getClientHeight());if(!(a.x>b.x||a.y>b.y)){var d=n.ToMapPoint(a.x,a.y),e=n.ToMapPoint(b.x,b.y);z=d.x;E=d.y;L=e.x;P=e.y;nWidth=parseInt(b.x-a.x);nHeight=parseInt(b.y-a.y);"MSIE"==DeviceTest()?AttachEvent(M,"readystatechange",T,!1):AttachEvent(M,"load",T,!1);I==G&&(a="?"+J.join("&"),"97"!=h&&(b=l.Inverse(p,new CPoint3(z, E,0)),d=l.Inverse(p,new CPoint3(L,P,0)),z=b.X,E=b.Y,L=d.X,P=d.Y),a+="&BBOX="+z+","+P+","+L+","+E+"&WIDTH="+nWidth+"&HEIGHT="+nHeight,M.src=A+a)}}};var aa=function(a,b){Q=b};this.CreateLegend=function(a){if(1a.x?a.x=0:a.x>g.getClientWidth()&&(a.x=g.getClientWidth());0>a.y?a.y=0:a.y>g.getClientHeight()&&(a.y=g.getClientHeight());0>b.x?b.x=0:b.x>g.getClientWidth()&&(b.x=g.getClientWidth());0>b.y?b.y=0:b.y>g.getClientHeight()&&(b.y=g.getClientHeight());if(!(a.x>b.x||a.y>b.y)){var e=g.ToMapPoint(a.x,a.y),f=g.ToMapPoint(b.x,b.y);B=e.x;H=e.y;A=f.x;I=f.y;nWidth=parseInt(b.x-a.x);nHeight=parseInt(b.y-a.y);a="/GetImage?V="+ G+"&S="+D.valueOf()+"&Width="+nWidth+"&Height="+nHeight+"&Left="+B+"&Top="+H+"&Right="+A+"&Bottom="+I;"MSIE"==DeviceTest()?AttachEvent(J,"readystatechange",t,!1):AttachEvent(J,"load",t,!1);J.src=d+a}}};var v=function(a,b){F=b};this.CreateLegend=function(a){if(1=e?a/-e-g:b.Z/f-g*(1-this.es),a=180*Math.atan(f/e)/Math.PI;b=0!= b.X?180*Math.atan2(b.Y,b.X)/Math.PI:0Math.abs(w))break}p=u;m=Math.PI/2;Math.abs(p)>=m?k=new CPoint3(0,0>l.Y?-m:m,l.Z):(s=Math.sin(p),m=Math.cos(p),n=1E-10=Math.abs(Math.abs(p.Y)-g))l=null;else{var m=p.X,n=Math.log(Math.tan(h+0.5*p.Y));l=new CPoint3(m,n,p.Z)}else 1E-10>=Math.abs(Math.abs(p.Y)-g)?l=null:(m=p.X,n=-Math.log(e(p.Y,Math.sin(p.Y),Math.sqrt(k.es))), l=new CPoint3(m,n,p.Z));l.X=l.X*f*k.SemiMajorAxis+d;l.Y=l.Y*f*k.SemiMajorAxis+a;return l};this.Inverse=function(e,h){var p=CPoint3((h.X-d)/e.SemiMajorAxis/f,(h.Y-a)/e.SemiMajorAxis/f,h.Z);if(0==e.es){var m=g-2*Math.atan(Math.exp(-p.Y));h=new CPoint3(p.X,m,p.Z)}else{var m=Math.exp(-p.Y),n=Math.sqrt(e.es),u=0.5*n,s=g-2*Math.atan(m);i=15;do var q=n*Math.sin(s),q=g-2*Math.atan(m*Math.pow((1-q)/(1+q),u))-s,s=s+q;while(1E-10k-1?k-1:0>a?0:a;if((a>=k||0>a)&&g==b)return!1;g= b;h=Math.pow(2,g);return!0};this.getScale=function(){return f*h};this.putScale=function(a){this.putMapLevel(Math.log(a/f)/Math.LN2)};this.getScaleX=function(){return f*h};this.getScaleY=function(){return e*h}} function MapBase(b,d){var a,f,e,g,h,k=0,l=0,p=0,m=0,n=null;e=[];g=[];h=null;n=d;a=b.ownerDocument.createElement("div");b.appendChild(a);a.style.position="absolute";a.style.overflow="hidden";a.style.left="0px";a.style.top="0px";a.style.width="100%";a.style.height="100%";a.style.zIndex=0;f=a.ownerDocument.createElement("div");a.appendChild(f);f.style.position="absolute";f.style.left="0px";f.style.top="0px";f.style.width="100%";f.style.height="100%";f.style.zIndex=0;var k=Number(f.clientWidth),l=Number(f.clientHeight), u,s=FuncAdapter(this,function(){if(k!=Number(f.clientWidth)||l!=Number(f.clientHeight))u&&clearTimeout(u),u=setTimeout(FuncAdapter(this,function(){this.RefreshMap(!0,!0)}),1E3),this.RefreshMap(!1,!1)});AttachEvent(f,"resize",s,!1);this.setColor=function(a){f.style.background=a};this.FinalRelease=function(){this.SelectMapTool(null);this.RemoveAllElements();DetachEvent(f,"resize",s,!1);a.removeChild(a)};this.getHObject=function(){return f};this.getHPackage=function(){return a};this.getClientWidth=function(){return k}; this.getClientHeight=function(){return l};this.getCenterX=function(){return p};this.putCenterX=function(a){p=a};this.getCenterY=function(){return m};this.putCenterY=function(a){m=a};this.getTransformation=function(){return n};this.putScale=function(a){n=a};this.getScale=function(){return n.getScale()};this.putScale=function(a){n.putScale(a)};this.getCellSizeX=function(){return this.ToMapDistX(1)};this.getCellSizeY=function(){return this.ToMapDistY(1)};this.MoveMapTo=function(a,b){this.putCenterX(a); this.putCenterY(b)};this.ZoomMapTo=function(a){if(null!=a.left&&null!=a.top&&null!=a.right&&null!=a.bottom){this.MoveMapTo((a.right+a.left)/2,(a.bottom+a.top)/2);var b=l/(a.bottom-a.top);this.putScale(Math.min(Math.abs(k/(a.right-a.left)),Math.abs(b)))}};this.getPackageOffset=function(){var b=0,d=0,d=a.getBoundingClientRect(),b=d.left,d=d.top;return new TGOS.TGPoint(b,d)};this.getCursorPosition=function(a){if(null==a)return null;var b=this.getPackageOffset();return new TGOS.TGPoint(a.clientX-b.x, a.clientY-b.y)};this.ToMapPoint=function(a,b){return new TGOS.TGPoint(this.ToMapDistX(a-k/2)+p,this.ToMapDistY(b-l/2)+m)};this.FromMapPoint=function(a,b){return new TGOS.TGPoint(this.FromMapDistX(a-p)+k/2,this.FromMapDistY(b-m)+l/2)};this.ToMapDistX=function(a){return a/n.getScaleX()};this.ToMapDistY=function(a){return a/n.getScaleY()};this.FromMapDistX=function(a){return a*n.getScaleX()};this.FromMapDistY=function(a){return a*n.getScaleY()};this.SelectMapTool=function(a){if(a){if(a.InitMapEvent)return h&& h.ExitMapEvent&&h.ExitMapEvent(),a.InitMapEvent(this),h=a,!0}else h&&h.ExitMapEvent&&(h.ExitMapEvent(),h=null);return!1};this.getLayers=function(){return e};this.AddLayer=function(a){null!=a&&(a.Initialize&&a.Initialize(this),e.push(a))};this.RemoveLayer=function(a){var b,d=e.length;for(b=0;bthis.FromMapDistX(h.getLeft()))&&(a=h.getLeft());h.getTop&&(null== b||this.FromMapDistY(b)>this.FromMapDistY(h.getTop()))&&(b=h.getTop());h.getRight&&(null==d||this.FromMapDistX(d)a.Left!=this.Right>this.Left||(this.Left=a.Left),!a.Top||null!=this.Top&&this.Topa.Bottom!=this.Top>this.Bottom||(this.Bottom=a.Bottom))};this.Shrink= function(a){a.constructor==TGOS.TGEnvelope&&(!a.Left||null!=this.Left&&this.Leftthis.Left||(this.Left=a.Left),!a.Top||null!=this.Top&&this.Top>a.Top!=this.Bottoma.Right!=this.Leftthis.Bottom||(this.Bottom=a.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(b,d,a,f,e,g){function h(a,b){var d,e,f=!1;this.ExitMapEvent=null;this.IsMapAction=function(){return f};this.InitMapEvent=function(g){var h=g.getHObject(),m=function(a){var b=a.screenX-d,f=a.screenY-e;d=a.screenX;e=a.screenY;g.MoveMapTo(g.getCenterX()-g.ToMapDistX(b),g.getCenterY()-g.ToMapDistY(f));g.RefreshMap(!1)},k=function(a){DetachEvent(h,"mousemove",m,!0);DetachEvent(h,"mouseup",k,!1);g.RefreshMap(!0);f=!1},l=function(a){util.disableDefault(a);f=!0;d=a.screenX;e=a.screenY;AttachEvent(h, "mouseup",k,!1);AttachEvent(h,"mousemove",m,!0)},v=function(b){a&&(f=!0,b=g.getCursorPosition(b),b=g.ToMapPoint(b.X,b.Y),g.MoveToAnimation(b,g.getScale(),function(){f=!1}))},n=function(a){if(b){f=!0;var d=g.getCursorPosition(a),d=g.ToMapPoint(d.X,d.Y),e=g.getScale(),h=a.wheelDelta?a.wheelDelta:-a.detail;a=0;0h&&(a=-1);h=1;h=g.getTransformation();h=null!=h&&null!=h.getLevelScale&&null!=h.getMapLevel?h.getLevelScale(h.getMapLevel()+a)/e:Math.pow(2,a);e*=h;d=new MapPoint((g.getCenterX()-d.X)/ h+d.X,(g.getCenterY()-d.Y)/h+d.Y);g.MoveToAnimation(d,e,function(){f=!1})}};this.ExitMapEvent=function(){b&&DetachEvent(h.ownerDocument,"mousewheel",n,!1);DetachEvent(h,"mousedown",l,!1);a&&DetachEvent(h,"dblclick",v,!1)};AttachEvent(h,"mousedown",l,!1);a&&AttachEvent(h,"dblclick",v,!1);b&&AttachEvent(h.ownerDocument,"mousewheel",n,!1)}}function k(a){switch(a){case "Open":b.style.width=f+"px";b.style.height=e+"px";b.style.border="2px solid";l.style.width=f+"px";l.style.height=e+"px";u.alt="Open"; u.src=TGOS.RES_PATH+"ShowClose.gif";u.status=!0;break;case "Close":b.style.width="11px",b.style.height="11px",b.style.border="0px",l.style.width="11px",l.style.height="11px",u.alt="Open",u.src=TGOS.RES_PATH+"ShowOpen.gif",u.status=!1}}var l=null,p=null,m=null,n=null,u,s=null,q=null;this.Show=function(a){a?(b.style.display="inline",k("Open")):b.style.display="none"};this.Minimize=function(){k("Close")};this.FinalRelease=function(){d.RemoveElement(this);n&&n.FinalRelease&&n.FinalRelease();n=null;m&& m.FinalRelease&&m&&m.FinalRelease&&m.FinalRelease();m=null;p&&b.removeChild(p);p=null};this.CenterXY=function(){return new MapPoint(m.getCenterX(),m.getCenterY())};this.SelectAreaHide=function(){m_IndexObj.style.visibility="hidden"};this.SelectAreaShow=function(){m_IndexObj.style.visibility="visible"};this.getTarget=function(){return d};this.getMapDiv=function(){return p};this.getMapBase=function(){return m};this.UpdateElement=function(){n.UpdateElement()};this.RebuildElement=function(){null!=n&& n.RebuildElement();if(null!=m){var a=d.getScale()/Math.pow(2,g);m.MoveToAnimation(new MapPoint(d.getCenterX(),d.getCenterY()),a)}};var w=new ScaleTransformation(1);w.putBaseScaleX(a.getBaseScaleX());w.putBaseScaleY(a.getBaseScaleY());l=document.createElement("div");b.appendChild(l);l.style.position="absolute";l.style.right="0px";l.style.bottom="0px";this.setColor=function(a){l.style.backgroundColor=a};this.getZoom=function(){var a=this.getTarget().getTransformation(),b=a.getMapLevel()-g;b>a.getMapMaxLevel()&& (b=a.getMapMaxLevel());bMath.abs(h)||10>Math.abs(m)?(b.style.width=d+"px",b.style.height=e+"px",l.style.width=d+"px",l.style.height=e+"px",b.style.border="0px",C=null,u.status&&(b.style.border="2px solid",b.style.width=d+"px",b.style.height= e+"px",l.style.width=d+"px",l.style.height=e+"px")):(b.style.width=f+h/2+"px",b.style.height=g+m/2+"px",l.style.width=f+h/2+"px",l.style.height=g+m/2+"px",C=setTimeout(function(){a(d,e)},50))};null!=C&&clearTimeout(C);C=null;(u.status=!u.status)?(u.alt="Close",u.src=TGOS.RES_PATH+"ShowClose.gif",a(f,e)):(u.alt="Open",u.src=TGOS.RES_PATH+"ShowOpen.gif",b.style.border="2px solid",a(parseInt(u.offsetWidth),parseInt(u.offsetHeight)))};m=new MapBase(p,w,"0px","0px","100%","100%");m.MoveMapTo(d.getCenterX(), d.getCenterY());m.RefreshMap(!0);n=new function(a){var b=a.getTarget(),d=a.getMapBase(),e=!1,f=new h(!1,!1),g=d.getHPackage(),m=document.createElement("div");g.appendChild(m);m.style.position="absolute";m.style.overflow="hidden";m.style.width="40px";m.style.height="40px";m.style.left="15px";m.style.top="15px";m.style.border="inset 1px #0300FA";a=m.ownerDocument.createElement("div");m.appendChild(a);a.style.filter="Alpha(Opacity=35)";a.style.opacity=0.35;a.style.MozOpacity=0.35;a.style.MozUserSelect= "none";a.style.backgroundColor="#5e38ff";a.style.width="100%";a.style.height="100%";var k,l,n=function(a){var e=a.screenX-k,f=a.screenY-l;k=a.screenX;l=a.screenY;b.MoveMapTo(b.getCenterX()+d.ToMapDistX(e),b.getCenterY()+d.ToMapDistY(f));b.RefreshMap(!1)},v=function(a){m.style.cursor="default";DetachEvent(m,"mousemove",n,!0);DetachEvent(m,"mouseup",v,!1);b.RefreshMap(!0)},p=function(a){util.disableDefault(a);k=a.screenX;l=a.screenY;m.style.cursor="move";AttachEvent(m,"mousemove",n,!0);AttachEvent(m, "mouseup",v,!1)};AttachEvent(m,"mousedown",p,!1);d.SelectMapTool(f);d.AddElement(this);this.FinalRelease=function(){d.RemoveElement(this);DetachEvent(m,"mousedown",p,!1);f&&f.FinalRelease&&f.FinalRelease();f=null;m&&g.removeChild(m);m=null};this.UpdateElement=function(){if(f.IsMapAction())e||(e=!0,s.x=parseInt(m.style.left)+parseInt(m.style.width)/2,s.y=parseInt(m.style.top)+parseInt(m.style.height)/2,a=d.ToMapPoint(s.x,s.y),b.MoveMapTo(a.x,a.y),b.RefreshMap(!1),e=!1);else{var a=b.ToMapPoint(0,0), g=b.ToMapPoint(b.getClientWidth(),b.getClientHeight());s=d.FromMapPoint(a.x,a.y);q=d.FromMapPoint(g.x,g.y);s.x&&s.y&&q.x&&q.y&&(m.style.left=s.x+"px",m.style.top=s.y+"px",m.style.width=q.x-s.x+"px",m.style.height=q.y-s.y+"px")}};this.RebuildElement=function(){f.IsMapAction()&&!e&&(e=!0,b.RefreshMap(!0),e=!1)}}(this);d.AddElement(this);this.RebuildElement()};TGOS.CTRL_ZINDEX=214748364; TGOS.HtmlControl=function(b,d,a,f,e){this.getDiv=function(){return k};this.getPosition=function(){return g};this.setPosition=function(a){var e=b.controls[g].indexOf(k);d in TGOS.TGControlPosition&&(0<=e&&b.controls[g].removeAt(e),b.controls[a].push(k),g=a)};this.setContent=function(a){"string"==typeof a&&(h.innerHTML=a)};this.remove=function(){b.getMapBase().RemoveElement(this);var a=b.controls[g];a.removeAt(a.indexOf(k))};var g=null,h=null,k=null,g=TGOS.TGControlPosition.BOTTOM_LEFT;d in TGOS.TGControlPosition&& (g=d);k=document.createElement("div");util.disableSelect(k);k.style.width="250px";k.style.height="50px";h=document.createElement("div");k.appendChild(h);h.innerHTML=a;h.style.position="absolute";h.style.fontFamily="calibri,\u5fae\u8edf\u6b63\u9ed1\u9ad4";h.style.fontWeight="600";h.style.left="5px";k.style.position="absolute";this.setPosition(g)}; TGOS.CopyrightControl=function(b,d){this.getDiv=function(){return e};this.getPosition=function(){return a};this.setPosition=function(f){var g=b.controls[a].indexOf(e);d in TGOS.TGControlPosition&&(0<=g&&b.controls[a].removeAt(g),b.controls[f].push(e),a=f)};var a=null,f=null,e=null,g=(new Date).getFullYear(),a=TGOS.TGControlPosition.BOTTOM_LEFT;d in TGOS.TGControlPosition&&(a=d);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(a)}; TGOS.MapTypeBarControl=function(b,d,a,f){function e(a){q=document.createElement("div");q.style.position="absolute";q.style.overflow="hidden";w=document.createElement("table");w.style.borderSpacing="0";w.border="0";q.appendChild(w);for(var d=w.insertRow(-1),e=0;e f?1:5>f?2:5)*k,g=d.FromMapDistX(f*g)+2,p=b/0.3048,k=p,J=1,b="\u82f1\u544e";21702k?1:5>k?2:5)*p;J=d.FromMapDistX(0.3048*k*J)+2;C.Inverse(w,new CPoint3(d.getCenterX(),d.getCenterY(),0));l.style.width=Math.round(Math.max(g,J))+"px";m.style.left=Math.round(g-4)+"px";n.style.left=Math.round(J-4)+"px";s.innerHTML=f+a;u.innerHTML=k+b;Math.round(Math.max(g,J))}};this.display=function(a){k.style.display= !1==a?"none":""};this.ControlOptionsChang=function(a,b){Location(b.getClientWidth(),b.getClientHeight())};this.setPosition(p);this.setStyle(q);this.UpdateElement()};function initControlArray(b){var d=b.controls,a=function(){f.BOTTOM_CENTER_update.call(d.BOTTOM_CENTER);f.BOTTOM_LEFT_update.call(d.BOTTOM_LEFT);f.BOTTOM_RIGHT_update.call(d.BOTTOM_RIGHT);f.LEFT_BOTTOM_update.call(d.LEFT_BOTTOM);f.LEFT_CENTER_update.call(d.LEFT_CENTER);f.LEFT_TOP_update.call(d.LEFT_TOP);f.RIGHT_BOTTOM_update.call(d.RIGHT_BOTTOM);f.RIGHT_CENTER_update.call(d.RIGHT_CENTER);f.RIGHT_TOP_update.call(d.RIGHT_TOP);f.TOP_CENTER_update.call(d.TOP_CENTER);f.TOP_LEFT_update.call(d.TOP_LEFT); f.TOP_RIGHT_update.call(d.TOP_RIGHT)},f={BOTTOM_CENTER_update:function(){var a=0,e=0;d.BOTTOM_CENTER.forEach(function(d,f){var p=parseInt(d.clientWidth,10),m=parseInt(d.clientHeight,10),n=0<=b.getMapSize().width/2-p/2?b.getMapSize().width/2-p/2:0;a+=p;e=Math.max(e,m);d.style.right="auto";d.style.left=n+"px";d.style.top="auto";d.style.bottom="0px"});d.BOTTOM_CENTER.totalWidth=a;d.BOTTOM_CENTER.totalHeight=e},BOTTOM_LEFT_update:function(){var a=0,b=0;d.BOTTOM_LEFT.forEach(function(d,e){var f=parseInt(d.scrollWidth, 10),m=parseInt(d.scrollHeight,10);a+=f;b=Math.max(b,m);d.style.right="auto";d.style.left=a-f+"px";d.style.top="auto";d.style.bottom="0px"});d.BOTTOM_LEFT.totalWidth=a;d.BOTTOM_LEFT.totalHeight=b},BOTTOM_RIGHT_update:function(){var a=0,b=0;d.BOTTOM_RIGHT.forEach(function(d,e){var f=parseInt(d.clientWidth,10),m=parseInt(d.clientHeight,10);a+=f;b=Math.max(b,m);d.style.left="auto";d.style.right=a-f+"px";d.style.top="auto";d.style.bottom="0px"});d.BOTTOM_RIGHT.totalWidth=a;d.BOTTOM_RIGHT.totalHeight=b}, TOP_LEFT_update:function(){var a=0,b=0;d.TOP_LEFT.forEach(function(d,e){var f=parseInt(d.clientWidth,10),m=parseInt(d.clientHeight,10);a+=f;b=Math.max(b,m);d.style.right="auto";d.style.left=a-f+"px";d.style.bottom="auto";d.style.top="0px"});d.TOP_LEFT.totalWidth=a;d.TOP_LEFT.totalHeight=b},TOP_CENTER_update:function(){var a=0,e=0;d.TOP_CENTER.forEach(function(d,f){var p=parseInt(d.clientWidth,10),m=parseInt(d.clientHeight,10),n=0<=b.getMapSize().width/2-p/2?b.getMapSize().width/2-p/2:0;a+=p;e=Math.max(e, m);d.style.right="auto";d.style.left=n+"px";d.style.bottom="auto";d.style.top="0px"});d.TOP_CENTER.totalWidth=a;d.TOP_CENTER.totalHeight=e},TOP_RIGHT_update:function(){var a=0,b=0;d.TOP_RIGHT.forEach(function(d,e){var f=parseInt(d.clientWidth,10),m=parseInt(d.clientHeight,10);a+=f;b=Math.max(b,m);d.style.left="auto";d.style.right=a-f+"px";d.style.bottom="auto";d.style.top="0px"});d.TOP_RIGHT.totalWidth=a;d.TOP_RIGHT.totalHeight=b},LEFT_TOP_update:function(){var a=0,b=0,e=0;0=a&&(a=0);return this.insertAt(a,b)};b.pop=function(){var b=this.arr_.length-1;if(!(0>b))return this.removeAt(b)};b.forEach=function(b){for(var a=0;athis.arr_.length- 1)){var a=this.arr_.splice(b,1);TGOS.TGEvent.trigger_(this,"remove_at",b,a[0]);TGOS.TGEvent.trigger_(this,"changed");return a}};b.insertAt=function(b,a){b>this.arr_.length||(this.arr_.splice(b,0,a),TGOS.TGEvent.trigger_(this,"insert_at",b),TGOS.TGEvent.trigger_(this,"changed"))};b.setAt=function(b,a){if(!(b>this.arr_.length-1)){var f=this.arr_[b];this.arr_.splice(b,1,a);TGOS.TGEvent.trigger_(this,"set_at",b,f);TGOS.TGEvent.trigger_(this,"changed")}};b.indexOf=function(b){return this.arr_.indexOf(b)}; TGOS.RegisterEvent(TGOS.MVCArray,["insert_at","remove_at","set_at","changed"])})();(function(){Array.prototype.find||Object.defineProperty(Array.prototype,"find",{value:function(a){for(var b=0;b>>0;b>>=0;b=0>b?Math.max(f+b,0):Math.min(b,f);d=void 0===d?f:d>>0;for(f=0>d?Math.max(f+ d,0):Math.min(d,f);b=a.length)){var b=a[0].getEventElement();if(b)for(var d=a.length,e=1;ed){a.splice(f,0,b);break}else if(f== a.length-1){a.push(b);break}};this.updateElementOrder=function(b){if(b){var d=b.getEventElement();if(d&&(b=b.getZIndex(),0!==a.length))for(var e=a.length,f=0;fb){d.insertBefore(h);break}else if(f==a.length-1){d.toFront();break}}}};this.containing=function(b){return 0<=a.indexOf(b)};this.remove=function(b){b=a.indexOf(b);a.splice(b,1)};this.UpdateElement=function(){for(var b=a.length,d=0;dthis.overlayForwardEvents.indexOf(a[b])&&this.overlayForwardEvents.push(a[b]);else a instanceof String&&0>this.overlayForwardEvents.indexOf(a)&&this.overlayForwardEvents.push(a)};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(a,b){S.OpenCloseKeyboardEditor(a,b)};this.getMapSize=function(){var a=parseInt(V.offsetWidth),b=parseInt(V.offsetHeight);return new TGOS.TGSize(a,b)};this.IndexViewControl={Show:function(a){Z.Show(a); Z.getMapBase().RefreshMap(!0)},Minimize:function(){Z.Minimize();Z.getMapBase().RefreshMap(!0)}};this.setCoordSys=function(a){a instanceof TGOS.TGCoordSys&&(v=a,TGOS.TGEvent.trigger(this,"projection_changed"))};this.getDocName=function(){var a;switch(v){case TGOS.TGCoordSys.EPSG3826:a=TGOS.MapTypeDocumentName;ba="97";break;case TGOS.TGCoordSys.EPSG3825:a=TGOS.MapTypeDocumentNameTWD97_119;ba="97_119";break;case TGOS.TGCoordSys.EPSG3857:a=TGOS.MapTypeDocumentNameGoogle,ba="google"}return a};this.getCoordSys= function(){return v};this.getOPackage=function(){return ia};this.getMapOptions=function(){return Q};this.getMapTypeId=function(){return W};this.getHPackage=function(){return V};this.getHPack=function(){return R.getHPackage()};this.getHObj=function(){return R.getHObject()};this.getHMap=function(){return R.getHObject()};this.getMapBase=function(){return R};this.getMap=function(){return this};this.ZoomTo=function(a){F(a)};this.ZoomIn=function(){F(fa.getMapLevel()+1)};this.ZoomOut=function(){F(fa.getMapLevel()- 1)};this.setOptions=function(a){var b=function(a){var b;switch(v){case TGOS.TGCoordSys.EPSG3857:b=TGOS.WGS84ToGoo(a.left,a.top);a=TGOS.WGS84ToGoo(a.right,a.bottom);b=new TGOS.TGEnvelope(b.x,b.y,a.x,a.y);break;default:b=a}fa.setMapBoundsLevel(b);S.setMapBounds(b);R.RefreshMap(!0)},d=function(a,b){var d=a,e=b;null!=d&&null!=e&&d>e&&(d=b,e=a);fa.setMapMinMaxLevel(d,e);R.RefreshMap(!0)},e=function(a){"string"==typeof a&&(R.setColor(a),Q.backgroundColor=a)},f=function(a){"boolean"==typeof a&&(a?(ja.display(!1), X.display(!1),da.display(!1)):(ja.display(!0),X.display(!0),da.display(!0)),Q.disableDefaultUI=a,R.RefreshMap(!0))},g=function(a){"boolean"==typeof a&&(aa=a,Q.scrollwheel=a,S.OpenCloseWheel(a))},h=function(a){"boolean"==typeof a&&(X.display(a),Q.mapTypeControl=a)},m=function(a){X.setOptions(a);Q.mapTypeControlOptions=a;R.RefreshMap(!0)},k=function(a){"boolean"==typeof a&&(da.display(a),Q.navigationControl=a);R.RefreshMap(!0)},l=function(a){da.setOptions(a);Q.navigationControlOptions=a},n=function(a){"boolean"== typeof a&&(ja.display(a),Q.scaleControl=a)},t=function(a){ja.setOptions(a);Q.scaleControlOptions=a},q=function(a){"boolean"==typeof a&&(Z.Show(a),Q.indexViewControl=a)},p=function(a){a==TGOS.TGIndexViewControlOptions.MINIMIZED&&(Z.Minimize(),Q.indexViewControlOptions=a)},z=function(a){"boolean"==typeof a&&(T=a,Q.draggable=a,S.OpenCloseMove(a))},s=function(a){"boolean"==typeof a&&(S.allowKeyboard(a),Q.keyboardShortcuts=a)},E=function(a){"boolean"==typeof a&&(S.setDragInertia(a),Q.dragInertia=a)},u= function(a){"string"==typeof a&&(S.changeDraggableCursor(a),Q.draggableCursor=a)},w=function(a){"string"==typeof a&&(S.changeDraggingCursor(a),Q.draggingCursor=a)};void 0!=a&&(void 0!=a.backgroundColor&&e(a.backgroundColor),void 0!=a.disableDefaultUI&&f(a.disableDefaultUI),void 0!=a.scrollwheel&&g(a.scrollwheel),void 0!=a.mapTypeControl&&h(a.mapTypeControl),void 0!=a.mapTypeControlOptions&&m(a.mapTypeControlOptions),void 0!=a.navigationControl&&k(a.navigationControl),void 0!=a.navigationControlOptions&& l(a.navigationControlOptions),void 0!=a.scaleControl&&n(a.scaleControl),void 0!=a.scaleControlOptions&&t(a.scaleControlOptions),void 0!=a.indexViewControl&&q(a.indexViewControl),void 0!=a.indexViewControlOptions&&p(a.indexViewControlOptions),void 0!=a.draggable&&z(a.draggable),void 0!=a.keyboardShortcuts&&s(a.keyboardShortcuts),void 0!=a.draggableCursor&&u(a.draggableCursor),void 0!=a.dragInertia&&E(a.dragInertia),void 0!=a.draggingCursor&&w(a.draggingCursor),void 0!=a.center&&ka.setCenter(a.center), void 0!=a.dbClickZoomIn&&S.OpenCloseDblClick(a.dbClickZoomIn),void 0!==a.maxZoom&&void 0!==a.minZoom?d(a.minZoom,a.maxZoom):(void 0!==a.maxZoom&&(fa.setMapMaxLevel(a.maxZoom),R.RefreshMap(!0)),void 0!==a.minZoom&&(fa.setMapMinLevel(a.minZoom),R.RefreshMap(!0))),void 0!==a.mapBounds&&b(a.mapBounds))};this.freezeMap=function(){oa||(S.ExitMapEvent(),oa=!0)};this.unFreezeMap=function(){oa&&(S.InitMapEvent(this),oa=!1)};this.loopThroughOverlay=function(){};this.resize=function(a,b){V.style.width=a+"px"; V.style.height=b+"px";l=V.clientWidth;p=V.clientHeight};this.getBoundary=function(){return R.getExtent()};this.getLevel=function(){return fa.getMapLevel()};this.getDiv=function(){return ya};this.getEventElement=function(){return this.getHObj()};this.getTransformation=function(){return fa};this.fitBounds=function(a){if(null!=a.left&&null!=a.top&&null!=a.right&&null!=a.bottom){var e={X:0,Y:0},f={X:0,Y:0};v==TGOS.TGCoordSys.EPSG3857?(e=d.Forward(b,new CPoint3(a.left,a.top,0)),f=d.Forward(b,new CPoint3(a.right, a.bottom,0))):(e.X=a.left,e.Y=a.top,f.X=a.right,f.Y=a.bottom);TGOS.moveMapTo_(this,(f.X+e.X)/2,(f.Y+e.Y)/2);a=Number(V.clientHeight)/(f.Y-e.Y);R.putScale(Math.min(Math.abs(Number(V.clientWidth)/(f.X-e.X)),Math.abs(a)));fa.FitLevel();R.RefreshMap(!0)}};this.getRawBound=function(){var a=l,b=p,d=R.ToMapPoint(0,0),a=R.ToMapPoint(a,b);return new TGOS.TGEnvelope(d.x,d.y,a.x,a.y)};this.getBounds=function(){var a=l,b=p,d=R.ToMapPoint(0,0),a=R.ToMapPoint(a,b),e,f,g,h;switch(v){case TGOS.TGCoordSys.EPSG3857:f= TGOS.GooToWGS84(d.x,d.y);d=TGOS.GooToWGS84(a.x,a.y);e=f.x;f=f.y;g=d.x;h=d.y;break;case TGOS.TGCoordSys.EPSG3826:e=d.x;f=d.y;g=a.x;h=a.y;break;case TGOS.TGCoordSys.EPSG3825:e=d.x,f=d.y,g=a.x,h=a.y}return new TGOS.TGEnvelope(e,f,g,h)};this.checkMapBoundsRestrict=function(a,b,d){var e=null;if(a){var f=0,g=0,h=this.getRawBound(),m=h.top-h.bottom,k=a.top-a.bottom;h.right-h.left>a.right-a.left?(f=1,b=(a.left+a.right)/2):h.lefta.right&&(f=h.right-a.right,b-=f);m>k? (g=1,d=(a.top+a.bottom)/2):h.top>a.top?(g=h.top-a.top,d-=g):h.bottomd&&(b=d);fa.putMapLevel(b);X.setActiveType(a);this.changeOverviewMapType(ha,a);R.RefreshMap(!0)}};this.panBy=function(a,b){S.panBy(a,b);R.RefreshMap(!0)};this.panToBounds=function(a){if(null!= a.left&&null!=a.top&&null!=a.right&&null!=a.bottom){var b,d;switch(v){case TGOS.TGCoordSys.EPSG3857:a=TGOS.WGS84ToGoo(a.left,a.top);b=a.x;d=a.y;break;case TGOS.TGCoordSys.EPSG3826:b=a.left;d=a.top;break;case TGOS.TGCoordSys.EPSG3825:b=a.left,d=a.top}TGOS.moveMapTo_(this,b,d);R.RefreshMap(!0)}};this.getLayerList=function(){return ga};this.setMapAction=function(a,b){if(1==a){var d=R.getHObject(),e=function(a,e,g,h){DetachEvent(d,"mousedown",f,!1);freezeMap||S.InitMapEvent(this);null!=b&&b(a,e,g,h)}, f=function(a){RectangleTracker(R,a,e)};S.ExitMapEvent();AttachEvent(d,"mousedown",f,!1)}else freezeMap||S.InitMapEvent(this)};this.getCoordinateString=function(a,b){var d=R.ToMapPoint(a,b);return d.x+","+d.y};this.changeOverviewMapType=function(a,b){for(var d=0;d=ha.length?ha[a]=b:ha.splice(a,0,b)}Z.getMapBase().AddLayer(ha[a]);ha[a].putVisible(!1)}},F=function(a){!oa&&fa.putMapLevel(a)&&(a=fa.getScale(),R.putScale(a),R.RefreshMap(!0))},t;this.setBackgroundColor=function(a){"string"==typeof a&&(t=!0,R.setColor(a),Q.backgroundColor=a)};this.getBackgroundColor=function(){return Q.backgroundColor};this.bcTimer=null;this.refreshMapWithIdle=function(a){clearTimeout(this.bcTimer);R.RefreshMap(!1);if(a){var b=this;this.bcTimer=setTimeout(function(){R.RefreshMap(!0); TGOS.TGEvent.trigger(b,"idle")},20)}};this.setMapTypeNLSC=function(a){Ba=a};this.getMapTypeNLSC=function(){return Ba};this.initialize_=function(g){this.infoWindowLayer=new a(na,this);this.overlay=new f(la);if("EPSG3857"==v){ba="google";var h=d.Forward(b,new CPoint3(118.9940295414,25.30028310652,0)),k=d.Forward(b,new CPoint3(122.0064955717,21.896606644941,0));xa=new TGOS.TGEnvelope(k.X,k.Y,h.X,h.Y);var h=TGOS.MapTypeScales.EPSG3857.levelX,k=TGOS.MapTypeScales.EPSG3857.levelY,n=TGOS.MapTypeScales.EPSG3857.scales}else"EPSG3825"== v?(ba="97_119",xa=new TGOS.TGEnvelope(339023.59349082,2425702.7292442,51368.8242689183,2799323.57990279),h=TGOS.MapTypeScales.EPSG3825.levelX,k=TGOS.MapTypeScales.EPSG3825.levelY,n=TGOS.MapTypeScales.EPSG3825.scales):(ba="97",xa=new TGOS.TGEnvelope(339023.59349082,2425702.7292442,51368.8242689183,2799323.57990279),h=TGOS.MapTypeScales.EPSG3826.levelX,k=TGOS.MapTypeScales.EPSG3826.levelY,n=TGOS.MapTypeScales.EPSG3826.scales);for(var t in TGOS.MapTypeMaxZoomLevel[v])Da=Math.max(TGOS.MapTypeMaxZoomLevel[v][t], Da);t=[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!==g&&(void 0!==g.mapTypeNLSC&&this.setMapTypeNLSC(g.mapTypeNLSC),void 0!==g.mapTypeControlOptions&&void 0!==g.mapTypeControlOptions.mapTypeIds&&(t=g.mapTypeControlOptions.mapTypeIds));C(t,ba);B(t,ba);V=document.createElement("div"); e.appendChild(V);V.style.position="relative";V.style.overflow="hidden";V.style.width=e.offsetWidth+"px";V.style.height=e.offsetHeight+"px";V.style.border="0px";V.style.left="0px";V.style.top="0px";V.unselectable="on";V.className="hpack";l=V.clientWidth;p=V.clientHeight;fa=new TGOS.MapScaleLevel(Aa,Da,h,k,n);R=new MapBase(V,fa);this.bindEvents(this.getEventElement());e.style.overflow="hidden";R.AddElement(this.overlay);R.AddElement(this.infoWindowLayer);R.setColor("#a5bfdd");R.ZoomMapTo(xa);fa.FitLevel(); initControlArray(this);for(h=0;h=M.length?d.insertBefore(g,e):d.insertBefore(g,M[0].div.main);var h=Raphael(g);h.canvas.setAttribute("fill-rule","evenodd");h.canvas.setAttribute("pointer-events","auto");h.rect(0,0,300,300).hide();var m=document.createElement("div"); m.style.position="absolute";m.style.width="100%";m.style.height="100%";m.style.pointerEvents="auto";m.className="IndependentContainer";a&&(m.className=m.className+"_"+a);d.insertBefore(m,e);d=Raphael(m);d.canvas.setAttribute("fill-rule","evenodd");d.canvas.setAttribute("pointer-events","auto");d.rect(0,0,300,300).hide();f={layerId:f,div:{main:m,shadow:g},paper:{main:d,shadow:h}};M.push(f);return f};this.removeAdvancedLayer=function(a){Y&&(a=Y.indexOf(a),0<=a&&Y.splice(a,1))};this.removeIndependentContainer= function(a){var b=this.getMapBase().getHObject();if(M){var d=M.indexOf(a);0<=d&&(b.removeChild(a.div.main),b.removeChild(a.div.shadow),M.splice(d,1))}};this.getAdvancedLayers=function(){return Y};this.getIndependentContainers=function(){return M};this.moveIndependentContainerToTop=function(a){var b=this.getMapBase().getHObject();if(null!=b&&M&&null!=a){var d=M.indexOf(a);if(0<=d&&01E3*b?(TGOS.moveMapTo_(l,a.x,a.y),l.refreshMapWithIdle(!0),clearInterval(v)):(d=(d-k)/(1E3*b),e.putCenterX(f+d*h),e.putCenterY(g+d*m),l.refreshMapWithIdle(!1))}, d)};this.panBy=function(a,b){var d=l.getMapBase(),e=d.getClientWidth(),f=d.getClientHeight(),g=d.getCenterX()+a,h=d.getCenterY()+b,d=d.FromMapPoint(g,h);0<=d.x&&d.x<=e&&0<=d.y&&d.y<=f?ga({x:g,y:h},0.5,30):TGOS.moveMapTo_(l,g,h)};this.panToBounds=function(a){var b=l.getMapBase();a=b.getClientWidth();var d=b.getClientHeight(),e=b.getCenterX()+offsetX,f=b.getCenterY()+offsetY,b=b.FromMapPoint(e,f);0<=b.x&&b.x<=a&&0<=b.y&&b.y<=d?ga({x:e,y:f},0.5,30):TGOS.moveMapTo_(l,e,f)};this.setMapBounds=function(a){p= a;var b=l.getMapBase();a=b.getCenterX();b=b.getCenterY();a=l.checkMapBoundsRestrict(p,a,b);null!=a&&(TGOS.moveMapTo_(l,a.x,a.y),l.refreshMapWithIdle(!0))};this.allowKeyboard=function(a){"boolean"==typeof a&&($=a)};this.clearNum=function(){c=0};var ha=!0;this.setDragInertia=function(a){"boolean"==typeof a&&(ha=a)};this.changeDraggableCursor=function(a){N=a;O.style.cursor=N};this.changeDraggingCursor=function(a){Q=a};this.InitMapEvent=function(g){var h=g.getMapBase();O=h.getHObject();h.getHPackage(); var k=[],w=function(a){setTimeout(function(){J=0},a)},B=function(a,b,d){var e=20;d&&(e=d);return Math.abs(a.X-b.X)<=e&&Math.abs(a.Y-b.Y)<=e?!0:!1},C=function(a,b){var d=h.getCursorPosition(a),e=h.getCursorPosition(b),f=parseFloat((d.x+e.x)/2),g=parseFloat((d.y+e.y)/2),d=Math.sqrt((d.x-e.x)*(d.x-e.x)+(d.y-e.y)*(d.y-e.y));return{scrCenter:{X:f,Y:g},length:d}},ga=function(a){var b;k=a.touches;ma&&ma.stop();V=ka=0;a=k[0];b={X:a.clientX,Y:a.clientY,MX:h.getCenterX(),MY:h.getCenterY()};0==J?J=1:2==J&&!0== B(b,I)?(J=3,D=a):J=0;I=b;if(1ta&&2R&&TGOS.TGEvent.trigger(l,"dragstart");TGOS.TGEvent.trigger(l,"drag");R++}},ma,pa=500,ta=0.08,za=function(b){util.disableDefault(b);if(d){DetachEvent(O,"mousemove",Ba,!0);DetachEvent(O,"mouseup",za,!0);O.style.cursor=N?N:"default";M=!1;if(ha&&Math.hypot(ka,V)>ta&&2b&&(g=-1);a.putMapLevel(a.getMapLevel()+g);b=h.getScale()/f;d=new TGOS.TGPoint((h.getCenterX()-d.x)/b+d.x,(h.getCenterY()-d.y)/b+d.y);p&&(b=l.checkMapBoundsRestrict(p,d.x,d.y),null!=b&&(d.x=b.x,d.y=b.y));TGOS.moveMapTo_(l,d.x,d.y);l.refreshMapWithIdle(!0)}},qa=0,Na=function(a){$&&(qa=0)},Ja=function(a){function b(a, d){TGOS.moveMapTo_(l,h.getCenterX()+a,h.getCenterY()+d);l.refreshMapWithIdle(!1)}if($&&!T){var d=h.getTransformation();qa+=4;24l&&(b=l),this.setMapMinLevel(b)};this.getBaseScaleX=function(){return I};this.putBaseScaleX=function(a){I=a};this.getBaseScaleY=function(){return G};this.putBaseScaleY=function(a){G=a};this.getMapMinLevel=function(){return p};this.setMapMinMaxLevel=function(b,d){l=null==d?TGOS.MapTypeMaxZoomLevel[a.getCoordSys()][a.getMapTypeId()]:Math.min(d,TGOS.MapTypeMaxZoomLevel[a.getCoordSys()][a.getMapTypeId()]);p=null==b?0:b;k>l?(this.putMapLevel(l), a.setZoom(l)):kl&&(this.putMapLevel(l),a.setZoom(l))};this.getMapMaxLevel=function(){Math.min(l,TGOS.MapTypeMaxZoomLevel[a.getCoordSys()][a.getMapTypeId()]);return l};this.setMapMinLevel=function(b){p=null==b?0:b;kl?l:g,n=null==p?0:p,q=b>g?g:bg||bt.sclientx-a.clientX||-2>t.sclienty-a.clientY)t.dragMoved=!0;b(a);DetachEvent(document.body,"mousemove",t.markMove,!0);DetachEvent(document.body,"mouseup",t.endDrag,!0);!t.dragMoved&& t.editable?null!=t.clickCallback&&t.clickCallback.call(this,t):null!=t.movedCallback&&t.movedCallback.call(this,t)};this.markMove=function(a){b(a);var d=l.getMapBase(),e=d.getPackageOffset(),f;switch(l.getCoordSys()){case TGOS.TGCoordSys.EPSG3857:f=d.ToMapPoint(a.clientX-e.x,a.clientY-e.y);f=TGOS.GooToWGS84(f.x,f.y);f=new TGOS.TGPoint(f.x,f.y);break;case TGOS.TGCoordSys.EPSG3826:f=d.ToMapPoint(a.clientX-e.x,a.clientY-e.y);break;case TGOS.TGCoordSys.EPSG3825:f=d.ToMapPoint(a.clientX-e.x,a.clientY- e.y)}a=f.x-t.spos.x;f=f.y-t.spos.y;d=m.getBounds();m.transform(1,0,0,1,a-(d.left-t.senv.left),f-(d.top-t.senv.top));t.update();t.editable&&null!=t.moveCallback&&t.moveCallback.call(this,t)};this.markDrag=function(a){b(a);t.sclientx=a.clientX;t.sclienty=a.clientY;t.dragMoved=!1;var d=l.getMapBase(),e=d.getPackageOffset(),f;switch(l.getCoordSys()){case TGOS.TGCoordSys.EPSG3857:a=d.ToMapPoint(a.clientX-e.x,a.clientY-e.y);a=TGOS.GooToWGS84(a.x,a.y);f=new TGOS.TGPoint(a.x,a.y);break;case TGOS.TGCoordSys.EPSG3826:f= d.ToMapPoint(a.clientX-e.x,a.clientY-e.y);break;case TGOS.TGCoordSys.EPSG3825:f=d.ToMapPoint(a.clientX-e.x,a.clientY-e.y)}t.spos=f;a=m.getBounds();t.senv=new TGOS.TGEnvelope(a.left,a.top,a.right,a.bottom);AttachEvent(document.body,"mousemove",t.markMove,!0);AttachEvent(document.body,"mouseup",t.endDrag,!0)};this.clone=function(){var a={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()},a=new TGOS.TGFill(null,this.getPath(),a);a.setTitle(this.getTitle());return a};this.setClickCallback=function(a){this.clickCallback=a};this.setMoveCallback=function(a){this.moveCallback=a};this.setMovedCallback=function(a){this.movedCallback=a};this.getEditable=function(){return this.editable};this.setEditable=function(a){this.editable=a;this.setDraggable(a)}; this.getDraggable=function(){return this.draggable};this.setDraggable=function(a){void 0!==a&&(this.draggable=a,this.elem&&(!0==a&&this.elem?this.elem.mousedown(this.markDrag):!1==a&&this.elem&&this.elem.unmousedown(this.markDrag)))};this.getVisible=function(){return K};this.setVisible=function(a){switch(a){case !0:K=!0;z.show();this.redraw();this.update();break;case !1:z.hide(),K=!1,this.redraw(),this.update()}};this.getAdvancedLayer=function(){return p};this.setAdvancedLayer=function(a){p=a};this.getPaper= function(){return null!=p?p.paper.main:l.getPaper()};this.getMap=function(){return l};this.setMap=function(a){z&&z.remove();if(null==a){if(!l)return;l.overlay.containing(this)&&l.overlay.remove(this);TGOS.TGEvent.clearInstanceListeners(this);l=null}a instanceof TGOS.TGOnlineMap&&(l=a,this.init())};this.getPath=function(){return m};this.setPath=function(a){m=a;this.redraw(!0)};this.isPointInEnvelope=function(a,b){var d=null,e=m;void 0!==e&&null!=e&&(e.getEnvelope&&(e=e.getEnvelope()),e.left&&(d=a>= e.left&&a<=e.right&&b>=e.bottom&&b<=e.top?!0:!1));return d};this.getEnvelope=function(){if(this.getPath){var a=this.getPath();if(void 0!==a)return void 0!==a.Envelope?a.Envelope:a}return null};this.getBounds=function(){if(m){var a=null;m instanceof TGOS.TGCircle?(a=l.getCoordSys(),a=m.getBounds(a)):a=m.getBounds();return a}};this.setClickable=function(a){"boolean"===typeof a&&((n=a)?TGOS.TGEvent.releaseEventLock(this,"click"):TGOS.TGEvent.lockEvent(this,"click"),TGOS.TGEvent.trigger(this,"clickable_changed"))}; this.getOpacity=function(){return u};this.setOpacity=function(a){u=a;z&&z.attr({opacity:u})};this.getFillOpacity=function(){return s};this.setFillOpacity=function(a){s=a;z&&z.attr({"fill-opacity":s})};this.getFillOutline=function(){return w};/*this.setFillOpacity=function(a){w=a;z&&z.attr({"stroke-opacity":u})};*/this.getTitle=function(){return J};this.setTitle=function(a){J=a;z&&(z.attr({title:J}),TGOS.TGEvent.trigger(this,"title_changed"))};this.getClickable=function(){return n};this.getFillColor=function(){return q}; this.setFillColor=function(a){q=a;z&&z.attr({fill:q})};this.getStrokeColor=function(){return C};this.setStrokeColor=function(a){C=a;z&&z.attr({stroke:a})};this.getStrokeWeight=function(){return B};this.setStrokeWeight=function(a){B=a;z&&z.attr({"stroke-width":B})};this.getStrokeOpacity=function(){return I};this.setStrokeOpacity=function(a){I=a;z&&z.attr({"stroke-opacity":I})};this.getStrokeLinecap=function(){return H};this.setStrokeLinecap=function(a){H=a;z&&z.attr({"stroke-linecap":H})};this.getStrokeLinejoin= function(){return A};this.setStrokeLinejoin=function(a){A=a;z&&z.attr({"stroke-linejoin":A})};this.getStrokeDasharray=function(){return G};this.setStrokeDasharray=function(a){G=a;z&&z.attr({"stroke-dasharray":G})};this.getZIndex=function(){return D};this.setZIndex=function(a,b){"number"===typeof a&&z&&(D=parseFloat(a),l.overlay.updateArrayOrder(this),l.overlay.updateElementOrder(this),TGOS.TGEvent.trigger(this,"zindex_changed"))};this.update=function(){if(m&&l)if(K){var a=l.getMapBase(),b=this.getAnchorPoint(), a=a.FromMapPoint(b.x,b.y);z.transform("t"+(a.x-h)+","+(a.y-k))}else z.hide()};this.createPathStr=function(){var b="",e=l.getCoordSys(),f=l.getMapBase(),g=f.getCellSizeX();e==TGOS.TGCoordSys.EPSG3857&&(g/=111E4);if(m instanceof TGOS.TGPolygon)for(var b=b+a(f,e,g,m.getExteriorRing()),h=m.getInteriorRings(),k=0;kK.sclientx-a.clientX||-2>K.sclienty-a.clientY)K.dragMoved=!0;b(a);DetachEvent(document.body,"mousemove",K.markMove,!0);DetachEvent(document.body, "mouseup",K.endDrag,!0);!K.dragMoved&&K.editable?null!=K.clickCallback&&K.clickCallback.call(this,K):null!=K.movedCallback&&K.movedCallback.call(this,K)};this.markMove=function(a){b(a);var d=h.getMapBase(),e=d.getPackageOffset(),f;switch(h.getCoordSys()){case TGOS.TGCoordSys.EPSG3857:f=d.ToMapPoint(a.clientX-e.x,a.clientY-e.y);f=TGOS.GooToWGS84(f.x,f.y);f=new TGOS.TGPoint(f.x,f.y);break;case TGOS.TGCoordSys.EPSG3826:f=d.ToMapPoint(a.clientX-e.x,a.clientY-e.y);break;case TGOS.TGCoordSys.EPSG3825:f= d.ToMapPoint(a.clientX-e.x,a.clientY-e.y)}a=l.Envelope;l.transform(1,0,0,1,f.x-K.spos.x-(a.left-K.senv.left),f.y-K.spos.y-(a.top-K.senv.top));K.update();K.editable&&null!=K.moveCallback&&K.moveCallback.call(this,K)};this.markDrag=function(a){K.sclientx=a.clientX;K.sclienty=a.clientY;K.dragMoved=!1;K.selected=!1;b(a);var d=h.getMapBase(),e=d.getPackageOffset(),f;switch(h.getCoordSys()){case TGOS.TGCoordSys.EPSG3857:a=d.ToMapPoint(a.clientX-e.x,a.clientY-e.y);a=TGOS.GooToWGS84(a.x,a.y);f=new TGOS.TGPoint(a.x, a.y);break;case TGOS.TGCoordSys.EPSG3826:f=d.ToMapPoint(a.clientX-e.x,a.clientY-e.y);break;case TGOS.TGCoordSys.EPSG3825:f=d.ToMapPoint(a.clientX-e.x,a.clientY-e.y)}K.spos=f;a=l.Envelope;K.senv=new TGOS.TGEnvelope(a.left,a.top,a.right,a.bottom);AttachEvent(document.body,"mousemove",K.markMove,!0);AttachEvent(document.body,"mouseup",K.endDrag,!0)};this.clone=function(){var a={opacity:this.getOpacity(),strokeWeight:this.getStrokeWeight(),strokeOpacity:this.getStrokeOpacity(),strokeLinecap:this.getStrokeLinecap(), strokeLinejoin:this.getStrokeLinejoin(),strokeColor:this.getStrokeColor(),strokeDasharray:this.getStrokeDasharray(),icons:this.getIcons()},a=new TGOS.TGLine(null,this.getPath(),a);a.setTitle(this.getTitle());return a};this.setClickCallback=function(a){this.clickCallback=a};this.setMoveCallback=function(a){this.moveCallback=a};this.setMovedCallback=function(a){this.movedCallback=a};this.getEditable=function(){return this.editable};this.setEditable=function(a){this.editable=a;this.setDraggable(a)}; this.getDraggable=function(){return this.draggable};this.setDraggable=function(a){this.draggable=a;F&&(a&&F?F.mousedown(this.markDrag):F.unmousedown(this.markDrag))};this.isPointInEnvelope=function(a,b){var d=null,e=l;void 0!==e&&null!=e&&(e.getEnvelope&&(e=e.getEnvelope()),e.left&&(d=a>=e.left&&a<=e.right&&b>=e.bottom&&b<=e.top?!0:!1));return d};this.getEventElement=function(){return F};this.calEnv=function(){for(var a=l.getPath(),b=Infinity,d=-Infinity,e=-Infinity,f=Infinity,g=0;ga&&0<=a&&(k=a,n&&n.attr({opacity:a}),this.redraw(),this.update())};this.getImage=function(){return null!=this.url?this.url:l};this.setImage=function(a){if(a instanceof TGOS.TGImage)l=a,n&&(n.attr({src:l.getUrl()}),this.redraw(),this.update());else if("string"==typeof a&&(this.url=a,-1=k.length)throw"Invalid WKT : "+b;b=k[1].toUpperCase();var l=k[2];if(d(b,"POINT"))return d=l.split(f),{type:"POINT",geometry:new TGOS.TGPoint(parseFloat(d[0]),parseFloat(d[1]))};if(d(b,"LINESTRING")){k=[];b=l.split(e);for(h=0;hh||d.x==a.x&&d.y==a.y?(f=-1,e=d.x,d=d.y):1b.right==this.right>this.left)||b.top&&(null==this.top||this.topb.top==this.top>this.bottom)?!1:!0}; TGOS.TGEnvelope.prototype.Extend=function(b){b.constructor==TGOS.TGEnvelope&&(!b.left||null!=this.left&&this.left>b.left!=this.right>this.left||(this.left=b.left),!b.top||null!=this.top&&this.topb.bottom!=this.top>this.bottom||(this.bottom=pEnv.bottom))}; TGOS.TGEnvelope.prototype.Shrink=function(b){b.constructor==TGOS.TGEnvelope&&(!b.left||null!=this.left&&this.leftthis.left||(this.left=b.left),!b.top||null!=this.top&&this.top>b.top!=this.bottomb.right!=this.leftthis.bottom||(this.bottom=b.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(b,d,a){var f=null,e=null,g=Infinity;void 0!==d&&(g=d);if(b instanceof TGOS.TGPoint){d=new TGOS.TGPoint(this.left,this.top);var h=new TGOS.TGPoint(this.right,this.top),k=new TGOS.TGPoint(this.right,this.bottom),l=new TGOS.TGPoint(this.left,this.bottom),p=new TGOS.TGPoint(this.left,this.top);d=new TGOS.TGLineString([d,h,k,l,p]);d.nearestPoint&&(b=d.nearestPoint(b,g,a),null!=b&&(null!=b.point&&(f=b.point),null!=b.distance&&(e=b.distance)))}return null!= f?{point:f,distance:e}:null};TGOS.TGEnvelope.prototype.transform=function(b,d,a,f,e,g){var h=new TGOS.TGPoint(this.left,this.top),k=new TGOS.TGPoint(this.right,this.bottom);h.transform(b,d,a,f,e,g);k.transform(b,d,a,f,e,g);this.left=h.x;this.top=h.y;this.right=k.x;this.bottom=k.y;this.renderer&&this.renderer.redraw()};TGOS.TGEnvelope.prototype.isEmpty=function(){var b=IsNumeric(this.left),d=IsNumeric(this.top),a=IsNumeric(this.right),f=IsNumeric(this.bottom);return!0==b&&!0==d&&!0==a&&!0==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(b){this.left=b};TGOS.TGEnvelope.prototype.setTop=function(b){this.top=b}; TGOS.TGEnvelope.prototype.setRight=function(b){this.right=b};TGOS.TGEnvelope.prototype.setBottom=function(b){this.bottom=b};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(b){return b.x>=this.left&&b.x<=this.right&&b.y>=this.bottom&&b.y<=this.top};TGOS.TGLineString=function(b){this.path=b;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(b,d,a){var f=null,e=null,g=Infinity;void 0!==d&&(g=d);var h=!0;void 0!==a.snapEdge&&(h=a.snapEdge);d=!0;void 0!==a.snapVertex&&(d=a.snapVertex);if(b instanceof TGOS.TGPoint&&(h||d)){if(d){var k=b.x,l=b.y;a=Infinity;var p;for(d=0;db&&(b=30),120a.sclientx-b.clientX||-2>a.sclienty-b.clientY)a.dragMoved=!0;DetachEvent(document.body, "mousemove",a.textMove,!0);DetachEvent(document.body,"mouseup",a.endDrag,!0);!a.dragMoved&&a.editable?null!=a.clickCallback&&a.clickCallback.call(this,a):null!=a.movedCallback&&a.movedCallback.call(this,a)};this.textMove=function(b){b=a.toMapPoint(b.clientX,b.clientY);b.x-=a.soffsetx;b.y-=a.soffsety;a.setPosition(b);a.editable&&null!=a.moveCallback&&a.moveCallback.call(this,a)};this.textDrag=function(b){a.sclientx=b.clientX;a.sclienty=b.clientY;var d=a.toMapPoint(a.sclientx,a.sclienty);a.soffsetx= d.x-a.position.x;a.soffsety=d.y-a.position.y;a.dragMoved=!1;b.cancelBubble=!0;b.stopPropagation&&b.stopPropagation();AttachEvent(document.body,"mousemove",a.textMove,!0);AttachEvent(document.body,"mouseup",a.endDrag,!0)};this.setClickCallback=function(a){this.clickCallback=a};this.setMoveCallback=function(a){this.moveCallback=a};this.setMovedCallback=function(a){this.movedCallback=a};b&&this.setOptions(b)};TGOS.extend(TGOS.Graphic,TGOS.TGLabel);var b=TGOS.TGLabel.prototype;b.font="";b.fontSize=12; b.fontWeight="normal";b.fontColor="#000000";b.opacity=1;b.backgroundColor="";b.position=null;b.label="";b.title="";b.zIndex;b.offset=null;b.visible=!0;b.map=null;b.mapbase=null;b.elem=null;b.clone=function(){var b={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(b)}; b.getEventElement=function(){return this.elem};b.isPointInEnvelope=function(){return null};b.update=function(){if(this.map){switch(this.map.getCoordSys()){case TGOS.TGCoordSys.EPSG3857:this.mapbase.FromMapPoint(this.position.x,this.position.y);var b=TGOS.WGS84ToGoo(this.position.x,this.position.y),a=this.mapbase.FromMapPoint(b.x,b.y);break;case TGOS.TGCoordSys.EPSG3826:a=this.mapbase.FromMapPoint(this.position.x,this.position.y);break;case TGOS.TGCoordSys.EPSG3825:a=this.mapbase.FromMapPoint(this.position.x, this.position.y)}b=a.x;a=a.y;this.offset&&(b+=this.offset.x,a+=this.offset.y);this.elem.transform("t"+b+","+a)}};b.setVisible=function(b){this.elem&&(!0==b?this.elem.show():!1==b&&this.elem.hide());this.visible=b;TGOS.TGEvent.trigger(this,"visible_changed")};b.getVisible=function(){return this.visible};b.setZIndex=function(b,a){void 0!=b&&this.elem&&(this.zIndex=b,this.map.overlay.updateArrayOrder(this),this.map.overlay.updateElementOrder(this),TGOS.TGEvent.trigger(this,"zindex_changed"))};b.getZIndex= function(){return this.zIndex};b.setFont=function(b){this.font=b;this.elem&&this.elem.attr({"font-family":this.font})};b.getFont=function(){return this.font};b.setFontSize=function(b){this.fontSize=b;this.elem&&this.elem.attr({"font-size":this.fontSize})};b.getFontSize=function(){return this.fontSize};b.setSize=function(b){this.size=b};this.getSize=function(){return this.size};b.setFontColor=function(b){this.fontColor=b;this.elem&&this.elem.attr({fill:this.fontColor})};b.getFontColor=function(){return this.fontColor}; b.setOpacity=function(b){this.opacity=b;this.elem&&this.elem.attr({opacity:this.opacity})};b.getOpacity=function(){return this.opacity};b.setBackgroundColor=function(b){this.backgroundColor=b};b.getBackgroundColor=function(){return this.backgroundColor};b.setPosition=function(b){this.position=b;this.update();TGOS.TGEvent.trigger(this,"position_changed")};b.getPosition=function(){return this.position};b.setLabel=function(b){this.label=b;this.elem&&this.elem.attr({text:this.label});TGOS.TGEvent.trigger(this, "label_changed")};b.getLabel=function(){return this.label};b.setTitle=function(b){this.title=b;this.elem&&(this.elem.attr({title:this.title}),TGOS.TGEvent.trigger(this,"title_changed"))};b.getTitle=function(){return this.title};b.setFontWeight=function(b){this.fontWeight=b;this.elem&&this.elem.attr({"font-weight":this.fontWeight})};b.getFontWeight=function(){return this.fontWeight};b.destroy=function(){this.map&&(this.map.overlay.remove(this),this.elem&&this.elem.remove())};b.getOffset=function(){return this.offset}; b.setOffset=function(b){b instanceof TGOS.TGPoint&&(this.offset=b,this.update())};b.setMap=function(b){this.destroy();null==b&&this.map?(this.map=null,TGOS.TGEvent.clearInstanceListeners(this)):b instanceof TGOS.TGOnlineMap&&(this.map=b,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())};b.getMap=function(){return this.map};b.getMapBase=function(){return this.mapbase};b.editable=!1;b.getEditable=function(){return this.editable};b.setEditable=function(b){this.editable=b;this.setDraggable(b)};b.draggable=!1;b.getDraggable=function(){return this.draggable};b.setDraggable=function(b){this.draggable=b;TGOS.TGEvent.trigger(this,"draggable_changed");this.elem&&(this.elem&&!0==b?this.elem.mousedown(this.textDrag):this.elem&&!1==b&&this.elem.unmousedown(this.textDrag))}; b.clickable=!1;b.getClickable=function(){return this.clickable};b.setClickable=function(b){"boolean"===typeof b&&((this.clickable=b)?TGOS.TGEvent.releaseEventLock(this,"click"):TGOS.TGEvent.lockEvent(this,"click"),TGOS.TGEvent.trigger(this,"clickable_changed"))};b.advancedLayer=null;b.getAdvancedLayer=function(){return this.advancedLayer};b.setAdvancedLayer=function(b){this.advancedLayer=b};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.setOptions=function(b){void 0!==b.zIndex&&this.setZIndex(b.zIndex);b.font&&this.setFont(b.font);b.fontColor&&this.setFontColor(b.fontColor);b.fontWeight&&this.setFontWeight(b.fontWeight);b.fontSize&&this.setFontSize(b.fontSize);b.label&&this.setLabel(b.label);b.backgroundColor&&this.setBackgroundColor(b.backgroundColor);void 0!==b.opacity&&this.setOpacity(b.opacity);void 0!==b.clickable&&this.setClickable(b.clickable); void 0!==b.draggable&&this.setDraggable(b.draggable);b.position&&this.setPosition(b.position);b.map&&this.setMap(b.map);this.update()};TGOS.RegisterEvent(TGOS.TGLabel,"label_changed zindex_changed click dblclick rightclick mousemove mousedown mouseup mouseover mouseout".split(" "))})();TGOS.TGInfoWindow=function(b,d,a){var f="",e,g,h,k,l=this,p,m;k=document.createElement("img");e=document.createElement("div");g=document.createElement("div");h=document.createElement("div");document.createElement("div");k.src=TGOS.RES_PATH+"Sample/Angle.png";k.style.position="absolute";k.style.height="21px";k.style.width="34px";k.style.zIndex=1E6;e.style.position="absolute";e.style.border="solid 1px #AAAAAA";e.style.backgroundColor="#ffffff";e.style.opacity=1;e.style.borderRadius="5px";e.style.overflow= "auto";g.style.width="auto";g.style.height="auto";g.style.position="absolute";g.style.overflow="auto";g.style.margin="10px";g.style["word-break"]="break-all";h.style.position="absolute";h.top="5px";h.style.width="15px";h.style.height="15px";h.style.overflow="auto";h.style.right="5px";h.style.zIndex=1E6;h.style.backgroundImage='url("'+TGOS.RES_PATH+'Sample/Close.png")';this.onCloseClick=function(a){l.close()};AttachEvent(h,"click",this.onCloseClick);e.appendChild(g);var n=100,u=new TGOS.TGSize(0,0), s=1E6;if(void 0!==a||null!=a)void 0!==a.maxWidth&&(n=a.maxWidth),void 0!==a.pixelOffset&&(u=a.pixelOffset),void 0!==a.optzIndex&&(s=a.optzIndex);var q=n,w=d||new TGOS.TGPoint(0,0),C=u,B=s,H=!0;this.getElement=function(){return e};this.open=function(a){a.infoWindowLayer.containing(this)?this.update():(a.getHPack().appendChild(e),a.getHPack().appendChild(k),a.getHPack().appendChild(h),a.infoWindowLayer.add(this),p=a,m=p.getMapBase(),e.style.zIndex=B,g.innerHTML="

"+f+"

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

'+f+"

";e.style.width=g.scrollWidth+40>q?q+40+"px":g.scrollWidth+40+"px";e.style.height=g.scrollHeight+30+"px";TGOS.TGEvent.trigger(this,"content_changed")};this.setPosition=function(a){a instanceof TGOS.TGPoint&&(a.x!==w.x||a.y!==w.y)&&(w=a,this.update(),TGOS.TGEvent.trigger(this,"position_changed"))};this.getPosition=function(){return w};this.getContentPane=function(){return g};this.setMaxWidth= function(a){q=a;e.style.width=g.scrollWidth+40>q?q+40+"px":g.scrollWidth+40+"px";e.style.height=g.scrollHeight+30+"px"};this.setZIndex=function(a){a!==B&&(B=a,e.style.zIndex=a,k.style.zIndex=a,h.style.zIndex=a,this.update(),TGOS.TGEvent.trigger(this,"zindex_changed"))};this.getZIndex=function(){return B};this.setPixelOffset=function(a){C=a;this.update()};this.disableAutoPan=function(a){"boolean"==typeof a&&(H=a)};this.putOpacity=function(a){e.style.opacity=a;k.style.opacity=a;h.style.opacity=a;e.style.filter= "alpha(opacity="+100*a+")";k.style.filter="alpha(opacity="+100*a+")";h.style.filter="alpha(opacity="+100*a+")"};this.panToCenter=function(){if(!1==H&&m&&p){var a=m.FromMapPoint(w.x,w.y),b=parseInt(a.x)-e.offsetWidth/2,a=parseInt(a.y)-e.offsetHeight/2;m.ToMapPoint(b,a);p.setCenter(w)}};this.setMessageText=function(a){this.setContent(a)};this.setOptions=function(a){void 0!=a&&("boolean"==typeof a.disableAutoPan&&this.disableAutoPan(a.disableAutoPan),a.position instanceof TGOS.TGPoint&&this.setPosition(a.position), "number"==typeof a.maxWidth&&this.setMaxWidth(a.maxWidth),a.pixelOffset instanceof TGOS.TGSize&&this.setPixelOffset(a.pixelOffset),"number"==typeof a.zIndex&&this.setZIndex(a.zIndex),"string"==typeof a.messageText&&this.setMessageText(a.messageText),"number"==typeof a.opacity&&this.putOpacity(a.opacity),this.update())};this.update=function(){if("undefined"!=typeof m&&p){switch(p.getCoordSys()){case TGOS.TGCoordSys.EPSG3857:var a=TGOS.WGS84ToGoo(w.x,w.y),a=m.FromMapPoint(a.x,a.y);break;case TGOS.TGCoordSys.EPSG3826:a= m.FromMapPoint(w.x,w.y);break;case TGOS.TGCoordSys.EPSG3825:a=m.FromMapPoint(w.x,w.y)}e.style.left=parseInt(a.x)+C.width+"px";e.style.top=parseInt(a.y)-19-parseInt(e.offsetHeight)+C.height+"px";k.style.left=parseInt(a.x)+C.width+"px";k.style.top=parseInt(a.y)-19+C.height+"px";h.style.left=parseInt(a.x)+e.clientWidth+C.width-20+"px";h.style.top=parseInt(e.style.top)+5+"px"}};this.setContent(b);this.setOptions({position:d});this.setOptions(a)}; TGOS.RegisterEvent(TGOS.TGInfoWindow,["closeclick","content_changed","position_changed","zindex_changed","domready"]);TGOS.TGImage=function(b,d,a,f,e){var g="";this.size=d instanceof TGOS.TGSize?d: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=a instanceof TGOS.TGPoint?a:new TGOS.TGPoint(0,0);this.setOptions=function(a){a.scale&&(this.scale=a.scale);a.hotSpot&&(this.hotSpot=a.hotSpot)};this.setUrl=function(a){"string"==typeof a&&(g=a)};this.getUrl=function(){return g};this.setUrl(b)}; TGOS.extend(TGOS.MVCObject,TGOS.TGImage);TGOS.TGSymbol=function(){var b={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 d=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,d);d.noFill=function(a){for(var d in b)if(b[d]==a)return!0;return!1};d.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 d}();TGOS.TGEvent=function(){var b=0>util.getInternetExplorerVersion()?0:1,d={standardDomMouseEvents:{click:"click",mousemove:"mousemove",mousedown:"mousedown",mouseover:"mouseover",mouseout:"mouseout",mouseup:"mouseup",dblclick:"dblclick",rightclick:"rightclick"},RIGHTBUTTON:2};d.LEFTBUTTON=b;TGOS.MapsEventListener=function(){};TGOS.OverlayCompleteEvent=function(a,b,d){this.overlay=a;this.type=b;this.action=d?d:""};TGOS.TGMouseEvent=function(a,b){Object.defineProperty(this,"type",{value:b||a.type});this.mapListener_= null;this.stop=function(){d.removeListener(this.mapListener_);this.mapListener_=null};this.stopPropagation=function(){a.stopPropagation&&a.stopPropagation();a.cancelBubble=!0};this.point=new TGOS.TGPoint};d.addListener_=function(a,b,d,g,h){if(a&&b&&a.events&&!(0>a.events.indexOf(b))){var k=a[b+"_"],l=null;k||(a[b+"_"]=[],k=a[b+"_"]);if(k)return l={target_:a,eventName_:b,targetQueue_:b+"_",handler_:d,executeLimit:h,capture:g},k.push(l),l}};d.addDomListener=function(a,b,e,g){return d.addListener_(a, b,e,g,Infinity)};d.addDomListenerOnce=function(a,b,e,g){return d.addListener_(a,b,e,g,1)};d.addListener=function(a,b,e,g){return d.addListener_(a,b,e,g,Infinity)};d.addListenerOnce=function(a,b,e,g){return d.addListener_(a,b,e,g,1)};d.clearInstanceListeners=function(a){if(a.events)for(var b=0;ba||b.splice(a,1))};d.trigger_=function(a,b){var e=null,e=a[b+"_"];if(!e||0>=e.length)return!1;for(var g=0;g=e[g].executeLimit&& d.removeListener(e[g]))};d.trigger=function(a,b){d.trigger_(a,b)};d.releaseEventLock=function(a,b){if(a&&a.events&&a.events.length&&b&&a.lockEvt&&0<=a.lockEvt.indexOf(b)){var d=a.lockEvt.indexOf(b);0>d||a.lockEvt.splice(d,1)}};d.lockEvent=function(a,b){a&&a.events&&a.events.length&&b&&(a.lockEvt||(a.lockEvt=[]),0<=a.lockEvt.indexOf(b)||a.lockEvt.push(b))};return d}();(function(){var b=TGOS.RES_PATH+"marker2.png",d=TGOS.RES_PATH+"shadow2.png";TGOS.TGMarker=function(a,b,d,h,k){var l=this;this.toMapPoint=function(a,b){var d,e=l.map.getMapBase(),f=e.getPackageOffset(),e=e.ToMapPoint(a-f.x,b-f.y);switch(l.map.getCoordSys()){case TGOS.TGCoordSys.EPSG3857:d=TGOS.GooToWGS84(e.x,e.y);d=new TGOS.TGPoint(d.x,d.y);break;case TGOS.TGCoordSys.EPSG3826:d=e;break;case TGOS.TGCoordSys.EPSG3825:d=e}return d};this.endDrag=function(a){if(2l.sclientx-a.clientX||-2>l.sclienty-a.clientY)l.dragMoved=!0;DetachEvent(document.body,"mousemove",l.markMove,!0);DetachEvent(document.body,"mouseup",l.endDrag,!0);!l.dragMoved&&l.editable?null!=l.clickCallback&&l.clickCallback.call(this,l):null!=l.movedCallback&&l.movedCallback.call(this,l)};this.markMove=function(a){a=l.toMapPoint(a.clientX,a.clientY);a.x-=l.soffsetx;a.y-=l.soffsety;l.setPosition(a);l.editable&&null!=l.moveCallback&&l.moveCallback.call(this,l)};this.markDrag=function(a){l.sclientx= a.clientX;l.sclienty=a.clientY;var b=l.toMapPoint(l.sclientx,l.sclienty);l.soffsetx=b.x-l.position.x;l.soffsety=b.y-l.position.y;l.dragMoved=!1;a.cancelBubble=!0;a.stopPropagation&&a.stopPropagation();AttachEvent(document.body,"mousemove",l.markMove,!0);AttachEvent(document.body,"mouseup",l.endDrag,!0)};this.setClickCallback=function(a){this.clickCallback=a};this.setMoveCallback=function(a){this.moveCallback=a};this.setMovedCallback=function(a){this.movedCallback=a};b instanceof TGOS.TGPoint&&(this.position= b);void 0!==h&&null!=h&&(this.icon=h);void 0!==d&&null!=d&&(this.title=d);this.getNode=function(){if(this.map&&this.advancedLayer){var a=this.getAdvancedLayer();return null!=a?[a.div.main,a.div.shadow]:this.map.getPanes().graphicLayer}};k&&this.setMarkerOptions(k);a&&this.setMap(a)};TGOS.extend(TGOS.Graphic,TGOS.TGMarker);var a=TGOS.TGMarker.prototype;a.elem=null;a.map=null;a.gPos=null;a.clone=function(){var a=new TGOS.TGMarker(null,this.getPosition(),this.getTitle(),this.getIcon());a.setShadow(this.getShadow()); a.setInfoAnchorPoint(this.getInfoAnchorPoint());a.setFlat(this.getFlat());return a};a.isPointInEnvelope=function(a,b,d){var h=null,k=this.position;if(void 0!==k&&null!=k){var l=this.icon;if(void 0!==l&&null!=l){var h=k.x-l.anchor.x*d,p=k.x+l.anchor.x*d,m=k.y+l.anchor.y*d,n=k.y-l.anchor.y*d;this.icon instanceof TGOS.TGImage?(p=k.x+(l.size.width-l.anchor.x)*d,n=k.y-(l.size.height-l.anchor.y)*d):this.icon instanceof TGOS.TGSymbol&&(p=k.x+(l.xPixel-l.anchor.x)*d,n=k.y-(l.yPixel-l.anchor.y)*d);h=a>=h&& a<=p&&b>=n&&b<=m?!0:!1}}return h};a.getEnvelope=function(){return new TGOS.TGEnvelope(this.position.x,this.position.y,this.position.x,this.position.y)};a.getBounds=function(){return new TGOS.TGEnvelope(this.position.x,this.position.y,this.position.x,this.position.y)};a.setMap=function(a){if(null===a)this.destroy(),this.map=null;else if(this.destroy(),a instanceof TGOS.TGOnlineMap){(this.map=a)&&this.map.getCoordSys()==TGOS.TGCoordSys.EPSG3857&&(this.gPos=TGOS.WGS84ToGoo(this.position.x,this.position.y)); this.map.overlay.add(this);this.getPaper();a=this.getShadowPaper();var b=this.shadow?this.shadow.getUrl():d;this.sImg=a.image(b,0,0,this.shadow.size.width,this.shadow.size.height);!0!=this.flat&&!1!=this.visible||this.sImg.hide();this.redrawMarker();this.update()}};a.getMap=function(){return this.map};a.getMapBase=function(){if(this.map)return this.map.getMapBase()};a.destroy=function(){this.map&&(this.elem&&this.elem.remove(),this.sImg&&this.sImg.remove(),this.map.overlay.remove(this),this.sImg= this.elem=null)};a.getEventElement=function(){return this.elem};a.title="";a.getTitle=function(){return this.title};a.setTitle=function(a){this.title=a;this.elem&&(this.elem.attr({title:this.title}),TGOS.TGEvent.trigger(this,"title_changed"))};a.setPath=function(a){this.setPosition(a)};a.position=null;a.getPosition=function(){return this.position};a.setPosition=function(a){a instanceof TGOS.TGPoint&&(this.position=a,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;a.getInfoAnchorPoint=function(){return this.infoAnchorPoint};a.setInfoAnchorPoint=function(a){this.infoAnchorPoint=a};a.icon=new TGOS.TGImage(b,new TGOS.TGSize(31,30),new TGOS.TGPoint(0,0),new TGOS.TGPoint(9,28));a.getIcon=function(){return this.icon};a.setIcon=function(a){if(a instanceof TGOS.TGImage||a instanceof TGOS.TGSymbol)this.icon=a,this.redrawMarker(),this.update(),TGOS.TGEvent.trigger(this, "icon_changed")};a.clickable=!1;a.getClickable=function(){return this.clickable};a.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"))};a.redrawMarker=function(){if((this.icon instanceof TGOS.TGImage||this.icon instanceof TGOS.TGSymbol)&&this.map){this.elem&&this.elem.remove();var b=this.getPaper();if(this.icon instanceof TGOS.TGImage)if(this.fitImageSize){var d= document.createElement("img"),g=this;d.onload=function(){var d=a.icon.size.width,e=a.icon.size.height;try{d=this.width,e=this.height}catch(l){}a.elem=b.image(g.icon.getUrl(),0,0,d,e);!1===a.visible?a.elem.hide():a.elem.show();null!=a.cursor&&a.elem.attr({cursor:a.cursor});null!=a.title&&a.elem.attr({title:a.title});g.map.overlay.updateElementOrder(g);g.bindEvents();g.update()};d.src=this.icon.getUrl()}else this.icon.scale?(d=document.createElement("img"),g=this,d.onload=function(d){g.icon.size.width= d.srcElement.width*g.icon.scale;g.icon.size.height=d.srcElement.height*g.icon.scale;a.elem=g.icon.scaledSize?b.image(g.icon.getUrl(),0,0,g.icon.scaledSize.width,g.icon.scaledSize.height):b.image(g.icon.getUrl(),0,0,g.icon.size.width,g.icon.size.height);!1===a.visible?a.elem.hide():a.elem.show();null!=a.cursor&&a.elem.attr({cursor:a.cursor});null!=a.title&&a.elem.attr({title:a.title});g.map.overlay.updateElementOrder(g);g.bindEvents();g.update()},d.src=this.icon.getUrl()):(this.elem=this.icon.scaledSize? b.image(this.icon.getUrl(),0,0,this.icon.scaledSize.width,this.icon.scaledSize.height):b.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){d=this.icon.symbolStyle in TGOS.TGSymbol.SymbolPath?TGOS.TGSymbol.SymbolPath[this.icon.symbolStyle]:this.icon.symbolStyle;if(!d)throw"Invalid SymbolStyle or path";this.elem=b.path(d);this.bbox_=this.elem.getBBox(!0);d=TGOS.TGSymbol.noFill(this.icon.symbolStyle);this.elem.attr({opacity:this.icon.opacity,fill:this.icon.fillColor,"fill-opacity":d?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()}}};a.icon_changed=function(){this.redrawMarker()};a.visible=!0;a.getVisible=function(){return this.visible};a.setVisible=function(a,b){this.visible=a;this.map&&(!0===this.visible?(this.elem.show(),!1===this.flat&&this.sImg.show()):(this.elem.hide(),this.sImg.hide()),b||this.update(), TGOS.TGEvent.trigger(this,"visible_changed"))};a.cursor=null;a.getCursor=function(){return this.cursor};a.setCursor=function(a){this.cursor=a;this.elem&&(this.elem.attr({cursor:this.cursor}),TGOS.TGEvent.trigger(this,"cursor_changed"))};a.zIndex=0;a.getZIndex=function(){return this.zIndex};a.setZIndex=function(a){this.zIndex=parseInt(a);this.map&&(this.map.overlay.updateArrayOrder(this),this.map.overlay.updateElementOrder(this),TGOS.TGEvent.trigger(this,"zindex_changed"))};a.editable=!1;a.getEditable= function(){return this.editable};a.setEditable=function(a){this.editable=a;this.setDraggable(a)};a.draggable=!1;a.getDraggable=function(){return this.draggable};a.setDraggable=function(a){this.draggable=a;TGOS.TGEvent.trigger(this,"draggable_changed");this.elem&&(this.elem&&!0==a?this.elem.mousedown(this.markDrag):this.elem&&!1==a&&this.elem.unmousedown(this.markDrag))};a.flat=!1;a.getFlat=function(){return this.flat};a.setFlat=function(a){this.flat=a;this.sImg&&(!0===this.flat?this.sImg.hide():this.sImg.show(), TGOS.TGEvent.trigger(this,"flat_changed"))};a.shadow=new TGOS.TGImage(d,new TGOS.TGSize(31,30),new TGOS.TGPoint(0,0),new TGOS.TGPoint(9,25));a.getShadow=function(){return this.shadow};a.setShadow=function(a){this.shadow=a;TGOS.TGEvent.trigger(this,"shadow_changed")};a.advancedLayer=null;a.getAdvancedLayer=function(){return this.advancedLayer};a.setAdvancedLayer=function(a){this.advancedLayer=a};a.getPaper=function(){return null!=this.advancedLayer?this.advancedLayer.paper.main:this.map.getPaper()}; a.getShadowPaper=function(){return null!=this.advancedLayer?this.advancedLayer.paper.shadow:this.map.getShadowPaper()};a.fitImageSize=!1;a.setFitImageSize=function(a){this.fitImageSize=a};a.setMarkerOptions=function(a){a&&(void 0!==a.advancedLayer&&this.setAdvancedLayer(a.advancedLayer),void 0!==a.visible&&this.setVisible(a.visible),void 0!=a.icon&&this.setIcon(a.icon),void 0!==a.shadow&&this.setShadow(a.shadow),void 0!=a.title&&this.setTitle(a.title),void 0!==a.position&&this.setPosition(a.position), void 0!==a.infoAnchor&&this.setInfoAnchorPoint(a.infoAnchor),void 0!==a.clickable&&this.setClickable(a.clickable),void 0!==a.cursor&&this.setCursor(a.cursor),void 0!=a.zIndex&&this.setZIndex(a.zIndex),void 0!==a.draggable&&this.setDraggable(a.draggable),void 0!==a.flat&&this.setFlat(a.flat),void 0!==a.shape&&this.setShape(a.shape),void 0!==a.fitImageSize&&this.setFitImageSize(a.fitImageSize))};a.update=function(){if(this.position&&this.visible&&this.elem&&this.map){var a;switch(this.map.getCoordSys()){case TGOS.TGCoordSys.EPSG3857:a= this.gPos;break;default:a=this.position}var b=this.map.getMapBase();if(this.map.getRawBound().contains(a)){this.visible&&(this.elem.show(),!0!==this.flat&&this.sImg.show());a=b.FromMapPoint(a.x,a.y);if(this.icon instanceof TGOS.TGImage){var b=a.x-this.icon.anchor.x,d=a.y-this.icon.anchor.y;this.icon.hotSpot&&(b=a.x-this.icon.hotSpot.x,d=a.y-this.icon.hotSpot.y);this.elem.attr({x:b,y:d});this.elem.attr({"clip-rect":b+","+d+","+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"+(a.x-this.icon.anchor.x)+","+(a.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:a.x-this.shadow.anchor.x,y:a.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 b=function(a,b,d,e){var f=this;this.manager=a;this.mode=b;this.active=!1;this.activeImage=d;this.inactiveImage=e;this.div=document.createElement("div");this.img=document.createElement("img");this.div.appendChild(this.img); this.setActive=function(a){this.active=a;this.img.src=this.active?f.activeImage:f.inactiveImage};this.destructor=function(){div.parentNode&&div.parentNode.removeChild(this.div);this.img=this.div=null};this.setActive(!1);this.div.onclick=function(){var a=f.manager.getDrawingMode()==f.mode?TGOS.TGOverlayType.NONE:f.mode;f.manager.setDrawingMode(a)}},d=function(a,b,d,e){var f=this;this.manager=a;this.mode=b;this.active=!0;this.enabledImage=d;this.disabledImage=e;this.div=document.createElement("div"); this.img=document.createElement("img");this.div.appendChild(this.img);this.setActive=function(a){this.active=a;this.img.src=this.active?f.enabledImage:f.disabledImage};this.destructor=function(){div.parentNode&&div.parentNode.removeChild(this.div);this.img=this.div=null};this.setActive(!0);this.div.onclick=function(){f.active&&f.manager.setModifyMode(f.mode)}},a=function(a){a.cancelBubble=!0;a.stopPropagation&&a.stopPropagation()},f=function(a,b){this.buttons=[];a&&(this.manager=a);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);a.map&&this.setMap(a.map);b&&this.setOptions(b)},e=f.prototype;e.setMap=function(a){this.map!=a&&(this.map=a,this.position&&a.controls[this.position].push(this.div))};e.setImages=function(a){this.images=a};e.setVisible=function(a){this.div.style.display=a?"":"none"};e.setPosition=function(a){if(this.manager.map){var b= this.manager.map.controls[this.position].indexOf(this.div);0<=b&&(this.manager.map.controls[this.position].removeAt(b),this.manager.map.controls[a].push(this.div),this.position=a)}};e.setOptions=function(a){a.images&&this.setImages(a.images);a.controlPosition&&this.setPosition(a.controlPosition);a.modifyModes&&this.setModes(a.modifyModes)};e.setButtonState=function(a,b){for(var d=!1,e=0;e=t.length&&(b=!1);!d.moveGraphicByKey||F!=TGOS.TGOverlayType.MARKER&&F!=TGOS.TGOverlayType.LABEL||1>=t.length&&(b=!0);var e,a=[],f=d.options.modifyIndicateOptions.pseudo;switch(F){case TGOS.TGOverlayType.POLYGON:3>t.length&&(b=!1);for(i=0;it.length&&(b=!1);for(i=0;ib.x?b.x:a.x,a.yb.y?b.y:a.y)};this.getAllGraphics=function(){return J};this.takeAllGraphics=function(){this.setDrawingMode(TGOS.TGOverlayType.NONE,!0);var a=[];for(i=0;i=m){var k=f;f=m;m=k}h=k;k+=12){var l=f+Math.sin(k*Math.PI/180)*h,t=g+Math.cos(k*Math.PI/180)*h;d.map.getCoordSys()==TGOS.TGCoordSys.EPSG3857?(l=TGOS.TWD97toWGS84(l,t),l=new TGOS.TGPoint(l.x,l.y)):l=new TGOS.TGPoint(l,t);m.push(l)}f=new TGOS.TGLineString(m);f=new TGOS.TGLinearRing(f);e.push(f);e=(new TGOS.TGPolygon(e)).toGeoJson()}else if(b== TGOS.TGOverlayType.POLYGON||b==TGOS.TGOverlayType.LINESTRING)e=a.getPath().toGeoJson();return e},Q,$=function(a,b){var e;e=a.slice();b&&e.pop();d.getDrawingMode()==TGOS.TGOverlayType.POLYGON?(e=new TGOS.TGLineString(e),e=new TGOS.TGLinearRing(e),e=new TGOS.TGPolygon([e])):e=new TGOS.TGLineString(e);d.map.getCoordSys()==TGOS.TGCoordSys.EPSG3857&&(e=TGOS.Geometry.Transform(e,TGOS.GooToWGS84));return e},T;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(a){if(a){var b="UNKNOWN";if(a instanceof TGOS.TGMarker)b="MARKER";else if(a instanceof TGOS.TGLabel)b="LABEL";else if(a.getPath){var e=a.getPath();if(e instanceof TGOS.TGEnvelope)b="ENVELOPE";else if(e instanceof TGOS.TGCircle)b="CIRCLE";else if(e instanceof TGOS.TGPolygon||e instanceof TGOS.TGMultiPolygon)b="POLYGON";else if(e instanceof TGOS.TGLineString||e instanceof TGOS.TGMultiLineString)b="LINESTRING"}a=new TGOS.OverlayCompleteEvent(a,b,"MOVED");TGOS.TGEvent.trigger_(d,"graphic_moved",a)}};this.cancelSegDrawing=function(){I=null;if(null!=T){T.setMap(null);var a=J.indexOf(T);0<=a&&J.splice(a,1);T=null}DetachEvent(D,"mousemove",S);DetachEvent(D,"dblclick", aa)};this.cancelEditingMode=function(){this.useDefaultControl&&(D.style.cursor="default");for(i=0;i=I.length&&(AttachEvent(D,"dblclick",aa),b==TGOS.TGOverlayType.POLYGON? T=new TGOS.TGFill(d.map,null,d.options.polygonOptions):b==TGOS.TGOverlayType.LINESTRING&&(T=new TGOS.TGLine(d.map,null,d.options.polylineOptions)));var f=d.map.getMapBase(),g=l(D),b=a.clientX-g.x;a=a.clientY-g.y;f=f.ToMapPoint(b,a);f=d.snapToGraphics(f);I.push(f);G||(G=d.map.getPaper().path("M"+b+","+a));b=$(I);null!=T&&T.setPath(b)}},S=function(a){var b=a.clientX;a=a.clientY;if(q!=b||w!=a){q=b;w=a;DEBUG_MODE&&console.log("drawMove.");e||(e=!ya(b,a,C,B))&&DEBUG_MODE&&console.log("drawMoved.");var f= d.map.getMapBase(),g=l(D),b=f.ToMapPoint(b-g.x,a-g.y),b=d.snapToGraphics(b);!I||0>=I.length||!T||(b=$(I.concat(b)),T.setPath(b))}},R=function(a){"tgoverlay"==a.currentTarget.className&&(DEBUG_MODE&&console.log("drawStart."),util.disableDefault(a),q=C=a.clientX,w=B=a.clientY,e=!1,AttachEvent(D,"mouseup",O),AttachEvent(D,"mousemove",S))},ka=function(b){if("tgoverlay"==b.currentTarget.className){util.disableDefault(b);a(b);DEBUG_MODE&&console.log("drawEnd.");DetachEvent(D,"mousemove",ia);DetachEvent(D, "dblclick",ka);var e=b.clientX;b=b.clientY;var f=d.map.getMapBase(),g=l(D),e=f.ToMapPoint(e-g.x,b-g.y),e=d.snapToGraphics(e);d.map.getCoordSys()==TGOS.TGCoordSys.EPSG3857&&(e=TGOS.Geometry.Transform(e,TGOS.GooToWGS84),e=new TGOS.TGPoint(e.x,e.y));b=d.getDrawingMode();var h,f=I[0];b==TGOS.TGOverlayType.CIRCLE?h=d.createCircle(f,e):b==TGOS.TGOverlayType.ENVELOPE&&(h=d.createEnvelope(f,e));I=null;h&&d.addGraphic(h,b);null!=T&&(T.setMap(null),T=null)}},V=function(a){DEBUG_MODE&&console.log("simpleUp."); DetachEvent(D,"mouseup",V);if(!e){var b=d.getDrawingMode();I||(I=[]);0>=I.length&&(AttachEvent(D,"dblclick",ka),b==TGOS.TGOverlayType.CIRCLE?T=new TGOS.TGFill(d.map,null,d.options.circleOptions):b==TGOS.TGOverlayType.ENVELOPE&&(T=new TGOS.TGFill(d.map,null,d.options.envelopeOptions)));var b=d.map.getMapBase(),f=l(D);a=b.ToMapPoint(a.clientX-f.x,a.clientY-f.y);a=d.snapToGraphics(a);d.map.getCoordSys()==TGOS.TGCoordSys.EPSG3857&&(a=TGOS.Geometry.Transform(a,TGOS.GooToWGS84),a=new TGOS.TGPoint(a.x,a.y)); I.push(a)}},ia=function(a){var b=a.clientX;a=a.clientY;if(q!=b||w!=a)if(q=b,w=a,DEBUG_MODE&&console.log("simpleMove."),e||(e=!ya(b,a,C,B))&&DEBUG_MODE&&console.log("simpleMoved."),I&&!(0>=I.length)&&T){var f=d.map.getMapBase(),g=l(D),b=f.ToMapPoint(b-g.x,a-g.y),b=d.snapToGraphics(b);d.map.getCoordSys()==TGOS.TGCoordSys.EPSG3857&&(b=TGOS.Geometry.Transform(b,TGOS.GooToWGS84),b=new TGOS.TGPoint(b.x,b.y));a=d.getDrawingMode();var h,f=I[0];a==TGOS.TGOverlayType.CIRCLE?h=d.createCircle(f,b):a==TGOS.TGOverlayType.ENVELOPE&& (h=d.createEnvelope(f,b));T&&T.setPath(h)}},na=function(a){if("tgoverlay"==a.currentTarget.className){DEBUG_MODE&&console.log("simpleStart.");util.disableDefault(a);q=C=a.clientX;w=B=a.clientY;e=!1;a=d.map.getMapBase();var b=l(D);a=a.ToMapPoint(C-b.x,B-b.y);p=d.snapToGraphics(a);d.map.getCoordSys()==TGOS.TGCoordSys.EPSG3857&&(a=TGOS.Geometry.Transform(p,TGOS.GooToWGS84),p=new TGOS.TGPoint(a.x,a.y));AttachEvent(D,"mousemove",ia);AttachEvent(D,"mouseup",V)}},la=function(b){if("tgoverlay"==b.currentTarget.className){util.disableDefault(b); a(b);DetachEvent(D,"mousemove",W,!1);DetachEvent(D,"mouseup",la,!1);var e=b.clientX,f=b.clientY;DEBUG_MODE&&console.log("dragEnd X = "+e+", Y = "+f);b=null;var g=d.getDrawingMode();if(g==TGOS.TGOverlayType.CIRCLE||g==TGOS.TGOverlayType.ENVELOPE){var h=l(D),e=e-h.x,f=f-h.y,e=d.map.getMapBase().ToMapPoint(e,f),e=d.snapToGraphics(e);d.map.getCoordSys()==TGOS.TGCoordSys.EPSG3857&&(e=TGOS.Geometry.Transform(e,TGOS.GooToWGS84),e=new TGOS.TGPoint(e.x,e.y));g==TGOS.TGOverlayType.CIRCLE?b=d.createCircle(p, e):g==TGOS.TGOverlayType.ENVELOPE&&(b=d.createEnvelope(p,e))}b&&d.addGraphic(b,g);null!=Q&&(Q.setMap(null),Q=null)}},W=function(a){var b=a.clientX;a=a.clientY;if(q!=b||w!=a){q=b;w=a;DEBUG_MODE&&console.log("dragMove.");var e=l(D),b=b-e.x;a-=e.y;b=d.map.getMapBase().ToMapPoint(b,a);b=d.snapToGraphics(b);d.map.getCoordSys()==TGOS.TGCoordSys.EPSG3857&&(b=TGOS.Geometry.Transform(b,TGOS.GooToWGS84),b=new TGOS.TGPoint(b.x,b.y));var f;a=d.getDrawingMode();DEBUG_MODE&&console.log("Move ("+b.x+","+b.y+")-("+ p.x+","+p.y+")");a==TGOS.TGOverlayType.CIRCLE?f=d.createCircle(p,b):a==TGOS.TGOverlayType.ENVELOPE&&(f=d.createEnvelope(p,b));Q&&Q.setPath(f)}},ba=function(b){if("tgoverlay"==b.currentTarget.className){util.disableDefault(b);a(b);q=H=b.clientX;w=A=b.clientY;DEBUG_MODE&&console.log("dragStart X = "+H+", Y = "+A);var e=l(D);b=H-e.x;e=A-e.y;b=d.map.getMapBase().ToMapPoint(b,e);p=d.snapToGraphics(b);d.map.getCoordSys()==TGOS.TGCoordSys.EPSG3857&&(b=TGOS.Geometry.Transform(p,TGOS.GooToWGS84),p=new TGOS.TGPoint(b.x, b.y));DEBUG_MODE&&console.log("clickPoint X= "+p.x+", Y = "+p.y);switch(d.getDrawingMode()){case TGOS.TGOverlayType.ENVELOPE:Q=new TGOS.TGFill(d.map,null,d.options.envelopeOptions);break;case TGOS.TGOverlayType.CIRCLE:Q=new TGOS.TGFill(d.map,null,d.options.circleOptions)}AttachEvent(D,"mousemove",W);AttachEvent(D,"mouseup",la)}},ga=function(b){if("tgoverlay"==b.currentTarget.className&&(util.disableDefault(b),a(b),DetachEvent(D,"mousemove",ha),DetachEvent(D,"mouseup",ga),!e)){var f=b.clientX;b=b.clientY; DEBUG_MODE&&console.log("clickEnd X = "+f+", Y = "+b);var g=null,h=d.getDrawingMode();if(h==TGOS.TGOverlayType.MARKER||h==TGOS.TGOverlayType.LABEL)g=l(D),f-=g.x,b-=g.y,f=d.map.getMapBase().ToMapPoint(f,b),g=d.snapToGraphics(f),d.map.getCoordSys()==TGOS.TGCoordSys.EPSG3857&&(f=TGOS.Geometry.Transform(g,TGOS.GooToWGS84),g=new TGOS.TGPoint(f.x,f.y));null!==g&&(DEBUG_MODE&&console.log("Add Point X= "+g.x+", Y = "+g.y),d.addGraphic(g,d.drawingMode))}},ha=function(b){util.disableDefault(b);a(b);e||(e=!ya(b.clientX, b.clientY,C,B))&&DEBUG_MODE&&console.log("clickMoved.")},Aa=function(a){"tgoverlay"==a.currentTarget.className&&(util.disableDefault(a),C=a.clientX,B=a.clientY,e=!1,DEBUG_MODE&&console.log("clickStart : X = "+C+", Y = "+B),AttachEvent(D,"mouseup",ga),AttachEvent(D,"mousemove",ha))},ya=function(a,b,d,e){var f=!1;a-1!==d&&a!==d&&a+1!==d||b-1!==e&&b!==e&&b+1!==e||(f=!0);return f};this.setDrawingMode=function(a,b){var e=this.drawingMode;if(e!=a){e!=TGOS.TGOverlayType.NONE&&(e==TGOS.TGOverlayType.POLYGON|| e==TGOS.TGOverlayType.LINESTRING?d.cancelSegDrawing():e==TGOS.TGOverlayType.EDIT?d.cancelEditingMode():e==TGOS.TGOverlayType.MODIFY&&(b?d.setModifyMode(TGOS.TGModifyType.CANCEL,!0):d.setModifyMode(TGOS.TGModifyType.CANCEL,!1)));D=this.map.getPanes().graphicLayer;DetachEvent(D,"mousedown",Aa);DetachEvent(D,"mousedown",ba);DetachEvent(D,"mousedown",R);DetachEvent(D,"mousemove",S);DetachEvent(D,"mousedown",na);DetachEvent(D,"mousemove",ia);d.useDefaultControl&&(D.style.cursor="crosshair");this.map.setOverlayForwardEvent(!1); switch(a){case TGOS.TGOverlayType.ENVELOPE:this.envelopeDblClick?AttachEvent(D,"mousedown",na):AttachEvent(D,"mousedown",ba);this.drawingMode=TGOS.TGOverlayType.ENVELOPE;break;case TGOS.TGOverlayType.CIRCLE:this.circleDblClick?AttachEvent(D,"mousedown",na):AttachEvent(D,"mousedown",ba);this.drawingMode=TGOS.TGOverlayType.CIRCLE;break;case TGOS.TGOverlayType.POLYGON:AttachEvent(D,"mousedown",R);this.drawingMode=TGOS.TGOverlayType.POLYGON;break;case TGOS.TGOverlayType.LINESTRING:AttachEvent(D,"mousedown", R);this.drawingMode=TGOS.TGOverlayType.LINESTRING;break;case TGOS.TGOverlayType.MARKER:AttachEvent(D,"mousedown",Aa);this.drawingMode=TGOS.TGOverlayType.MARKER;break;case TGOS.TGOverlayType.LABEL:AttachEvent(D,"mousedown",Aa);this.drawingMode=TGOS.TGOverlayType.LABEL;break;case TGOS.TGOverlayType.EDIT:d.useDefaultControl&&(this.modifyControl.setVisible(!1),this.drawingControl.setVisible(!0),D.style.cursor="pointer");for(i=0;i=h?l.onreadystatechange=function(){this.readyState&&"loaded"!==this.readyState&&"complete"!==this.readyState||(this.parentNode.removeChild(l),l=void 0)}:l.onload=function(){this.parentNode.removeChild(l);l=void 0};l.onerror=function(){e&&e.call(this);this.parentNode.removeChild(l);l=void 0};TGOS.ajaxCount__++;l.src=d;f[0].appendChild(l)}}})(); TGOS.loadJsonData=function(b,d,a,f,e){var g=document.createElement("script");g.type="text/javascript";document.body.appendChild(g);d=0<=d.indexOf("?")?d+"&keystr="+encodeURIComponent(TGOS.tgHash):d+"?keystr="+encodeURIComponent(TGOS.tgHash);d+="&rn="+Math.floor(1E5*Math.random()+1);g.onreadystatechange=function(){"loaded"==this.readyState&&a.call(this,dataObj)};g.onload=function(){a.call(this,dataObj);g.parentNode.removeChild(g);for(var b in g)delete g[b]};g.onerror=function(){f&&f.call(this)};""== b?g.src=d:(e&&(g.src=b+"?serv="+encodeURIComponent(d)+"&skip=true&hash="+TGOS.tgHash),g.src=b+"?serv="+encodeURIComponent(d))};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(b,d,a,f){var e={getImageUrl:"",district:[]},g="";switch(b){case TGOS.TGStatMapId.COUNTYMAP:g="county";break;case TGOS.TGStatMapId.TOWNMAP:g="town";break;case TGOS.TGStatMapId.VILLAGEMAP:g="village"}var h="string"==typeof a.layer?a.layer:"",k="string"==typeof a.code?a.code:"",l="ei";switch("string"==typeof a.classifyMethod?a.classifyMethod:""){case "EqualInterval":l="ei";break;case "Quantile":l="qt";break;case "StanDevi":l="sd"}var p="number"==typeof a.classes? a.classes.toString():"",m="green";switch(a.graduatedColor.toLowerCase()){case "red":m="red";break;case "yellow":m="yellow";break;case "green":m="green";break;case "blue":m="blue"}var n="number"==typeof a.height?a.height.toString():"",u="number"==typeof a.width?a.width.toString():"";TGOS.getJSON(TGOS.STATISTICS_SERVICE2+"?width="+u+"&height="+n+"&district="+g+"&color="+m+"&layer="+h+"&code="+k+"&method="+l+"&classnum="+p,function(a){if(a&&a.error)f.call(this,null,"REQUEST_DENIED");else{e.district= a.district;e.legend=a.legend;var b=parseFloat(a.envelope.left),d=parseFloat(a.envelope.top),C=parseFloat(a.envelope.right);a=parseFloat(a.envelope.bottom);e.envelope=new TGOS.TGEnvelope(b,d,C,a);b=TGOS.STATISTICS_SERVICE+"?width="+u+"&height="+n+"&district="+g+"&color="+m+"&layer="+h+"&code="+k+"&method="+l+"&classnum="+p;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 b(a,b,d){var f=[];new TGOS.TGTransformation;var l="",p="";switch(d){case "84":p="EPSG:4326";break;case "97_119":p="EPSG:3825";break;default:p="EPSG:3826"}TGOS.getJSON(TGOS.ADDRESSLOCATE_SERVICE+"?oAddress="+a.address+"&oSRS="+p+"&oResultDataType=jsonp&pnum="+parseInt(a.pageNumber),function(a){if(a&&a.Info&&a.Info.length)if(0>=parseInt(a.Info[0].OutTotal))l=TGOS.TGLocatorStatus.ZERO_RESULTS,b.call(this,null,l);else{l=TGOS.TGLocatorStatus.OK;30=a.Table.length)b.call(this,f,TGOS.TGLocatorStatus.ZERO_RESULTS,0,0);else{for(var e=0;ea.pageNumber?1:parseInt(a.pageNumber); k=TGOS.QUERY_SERVICE+"?op=att&res="+TGOS.MapIdInfo[b].resource;k+="&layer="+TGOS.MapIdInfo[b].layers[d].name;k+="&EXPR="+encodeURIComponent(g);h.fieldAttr=[];h.position=[];TGOS.getJSON(k+("&page="+a),function(a){var g="";if(a&&a.error)e.call(this,null,"REQUEST_DENIED",0,0);else if(a){var k=a.Feature,l=null,p=[],w=null,C=a.items;a=a.pages;for(var B in TGOS.MapIdInfo[b].layers[d].query)g=g+B+",";h.fieldName=g;for(var g=k.length,H=0;H>1):p>>1;p=l=0;do k=b.charCodeAt(f++)-63,p|=(k&31)<>1):p>>1;h.push(e*d);h.push(g*d)}return h};TGOS.TGAddressStatus={ERROR:"ERROR",INVALID_REQUEST:"INVALID_REQUEST",OK:"OK",ZERO_RESULTS:"ZERO_RESULTS"}; TGOS.TGAddress=function(){return function(){this.nearestAddress=function(b,d,a){if(!(b instanceof TGOS.TGPoint))throw"Must be a Point @nearestAddress";var f="EPSG:3826";switch(d){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="+b.x+"&oPY="+b.y,function(b){b= b.AddressList;0>=b.length?a.call(this,null,TGOS.TGAddressStatus.ZERO_RESULTS):(b=b[0],b={formattedAddress:b.FULL_ADDR,addressComponents:{county:b.COUNTY,town:b.TOWN,village:b.VILLAGE,neighborhood:b.NEIGHBORHOOD,road:b.ROAD,section:b.SECTION,lane:b.LANE,alley:b.ALLEY,sub_alley:b.SUB_ALLEY,tong:b.TONG,number:b.NUMBER},geometry:{bounds:new TGOS.TGEnvelope(b.X,b.Y,b.X,b.Y),location:new TGOS.TGPoint(b.X,b.Y)}},a.call(this,b,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 b=function(a){if(!a)return"";for(var b in TGOS.COUNTYCODES)if(a.replace("\u53f0","\u81fa")==TGOS.COUNTYCODES[b])return b},d=TGOS.LOCATOR_SERVICE,a=getWebProtocal()+getServicePath()+"TGLocator/TGLocator.ashx",f=function(){};f.prototype.buildDescription=function(a,b,d,f){var l="",p="",m="";switch(a){case TGOS.TGMileageType.HIGHWAY:l="\u570b\u9053";break;case TGOS.TGMileageType.EXPRESSWAY:l="\u5feb\u901f\u9053\u8def";break;case TGOS.TGMileageType.PROVINCEWAY:l="\u7701\u9053"; break;case TGOS.TGMileageType.TRA:l="\u53f0\u9435";break;case TGOS.TGMileageType.HSR:l="\u9ad8\u9435"}m=a==TGOS.TGMileageType.HSR?m+l:m+(l+f);if(a==TGOS.TGMileageType.HIGHWAY){switch(b){case TGOS.TGDirectionType.E:p="\u6771\u5411";break;case TGOS.TGDirectionType.W:p="\u897f\u5411";break;case TGOS.TGDirectionType.S:p="\u5357\u5411";break;case TGOS.TGDirectionType.N:p="\u5317\u5411"}m+=","+p}return m+(","+d+"\u516c\u91cc")};f.prototype.calcViewport=function(a,b,d){switch(d){case TGOS.TGCoordSys.EPSG3857:b= TGOS.WGS84ToGoo(a,b);a=TGOS.GooToWGS84(b.x-500,b.y+500);b=TGOS.GooToWGS84(b.x+500,b.y-500);a=new TGOS.TGEnvelope(a.x,a.y,b.x,b.y);break;default:a=new TGOS.TGEnvelope(a-500,b+500,a+500,b-500)}return a};f.prototype.buildGeometry=function(a,b){var d=new TGOS.TGPoint,f;switch(b){case TGOS.TGCoordSys.EPSG3826:d.x=a.TWD97X||a["97X"];d.y=a.TWD97Y||a["97Y"];break;case TGOS.TGCoordSys.EPSG3857:d.x=a.Lng;d.y=a.Lat;break;case TGOS.TGCoordSys.EPSG3825:x97=a.TWD97X||a["97X"],y97=a.TWD97Y||a["97Y"],f=TGOS.TWD97toTWD97_119(x97, y97),d.x=f.x,d.y=f.y}f=this.calcViewport(d.x,d.y,b);return{location:d,bounds:new TGOS.TGEnvelope(d.x,d.y,d.x,d.y),viewport:f}};f.prototype.complexLocate=function(b,d,f){var k=this,l=b.requestText,p=b.town,m=b.county,n=b.geometryInfo,u=b.pageNumber;b=b.center;var s;switch(d){case TGOS.TGCoordSys.EPSG3826:s="EPSG:3826";break;case TGOS.TGCoordSys.EPSG3857:s="EPSG:4326"}l=a+"?format=jsonp&input="+l+"&srs="+s;m&&(l+="&county="+m);p&&(l+="&town="+p);l+=n?"&ignoreGeometry=false":"&ignoreGeometry=true";"number"== typeof u&&(l+="&pnum="+u);b instanceof TGOS.TGPoint&&!isNaN(b.x)&&!isNaN(b.y)&&(l+="¢er="+b.x+","+b.y);TGOS.getJSON(l,function(a){var b=a.status,e=a.results,l=a.featureCount,m=a.pages,p=[];if("OK"==b||"TOO_MANY_RESULTS"==b)for(var n=0;n=a.Table.length?(d=TGOS.TGLocatorStatus.ZERO_RESULTS,f.call(k,null,null,d)):(d=k.buildDescription(l,m,n,a.Table[0].Number),a=k.buildGeometry(a.Table[0],b),f&&f.call(k,d,a,"OK"),TGOS.Log("web","A17","")):(d=TGOS.TGLocatorStatus.ERROR,f.call(k,null,null,d))})};return f}();(function(){var b=["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(d,a,f){var e=this,g=a.map,h=!1,k,l="auto",p=!0;a&&(void 0!==a.zIndex&&"number"==typeof a.zIndex&&(l=a.zIndex),void 0!==a.visible&&"boolean"==typeof a.visible&&(p=a.visible),void 0!==a.independentContainer&&"boolean"== typeof a.independentContainer&&(h=a.independentContainer,!0==h&&(k=g.addIndependentContainer("KML",this))));var m=g.getCoordSys(),n={author:{email:"",name:"",uri:""},description:"",name:"",snippet:""},u,s=new TGOS.TGInfoWindow("",null,{pixelOffset:new TGOS.TGSize(0,0)}),q=null,w=a.markerFitImageSize;this.overlays=[];this.points=[];this.polygons=[];this.polylines=[];this.groundoverlays=[];this.icons=[];this.getDefaultViewport=function(){if(!q){for(var a=Infinity,b=-Infinity,d=-Infinity,e=Infinity, f=0;fb.length))return b[0]};this.parseRing=function(a,b){switch(b){case "EPSG3826":var d=this.parseCoordinates(a.coordinates,"EPSG3826");break;case "EPSG3825":d=this.parseCoordinates(a.coordinates,"EPSG3825");break;case "EPSG3857":d=this.parseCoordinates(a.coordinates,"EPSG3857")}d=new TGOS.TGLineString(d);return new TGOS.TGLinearRing(d)};this.createPolygon=function(a){var b=[], d=this.parseRing(a.outerBoundaryIs.LinearRing,m);b.push(d);var e=a.innerBoundaryIs;if(e)if(e.length)for(var f=0;fa.r&&(b="0"+ b);var d=a.g.toString(16);16>a.g&&(d="0"+d);var e=a.b.toString(16);16>a.b&&(e="0"+e);return"#"+b+d+e}};this.handlePlacemark=function(b,d){var e=[];if(b.length)for(var f=0;f");0";for(b=0;b",f=f+"",f=f+"",f=f+"";f+="
",f=f+(m||d),f=f+"",f=f+l,f=f+"
"}if(h.SchemaData)for(h=h.SchemaData.length?h.SchemaData:[h.SchemaData],k=0;k";for(b=0;b",f+="",f+="",f+="";f+="
",f+=p+":"+d,f+="",f+=void 0===l?"":l,f+="
"}}}0e&&h.substr(0,e)==b){var k=a[h];void 0!==k&&d(k,b);delete a[h];h=h.replace(b,"");a[h]=k}}}if(!b||b.error)u=TGOS.TGKmlLayerStatus.FETCH_ERROR,"function"==typeof f&&f.call(this,u);else{var h=b.kml;void 0==h&&(h=b["kml:kml"],void 0!==h&&d(h,"kml:"));h.Document?(h.Document.hasOwnProperty("description")&&null!=h.Document.description&&(h.Document.description.hasOwnProperty("#cdata-section")? n.description=h.Document.description["#cdata-section"]:n.description=h.Document.description),h.Document.hasOwnProperty("name")&&null!=h.Document.name&&(h.Document.name.hasOwnProperty("#cdata-section")?n.name=h.Document.name["#cdata-section"]:n.name=h.Document.name),h.Document.hasOwnProperty("Snippet")&&null!=h.Document.Snippet&&(h.Document.Snippet.hasOwnProperty("#cdata-section")?n.snippet=h.Document.Snippet["#cdata-section"]:n.snippet=h.Document.Snippet),h.Document.hasOwnProperty("atom:author")&& e.handleAuthor(h.Document["atom:author"]),e.Schema=h.Document.Schema):(h.hasOwnProperty("description")&&null!=h.description&&(h.description.hasOwnProperty("#cdata-section")?n.description=h.description["#cdata-section"]:n.description=h.description),h.hasOwnProperty("name")&&null!=h.name&&(h.name.hasOwnProperty("#cdata-section")?n.name=h.name["#cdata-section"]:n.name=h.name),h.hasOwnProperty("Snippet")&&null!=h.Snippet&&(h.Snippet.hasOwnProperty("#cdata-section")?n.snippet=h.Snippet["#cdata-section"]: n.snippet=h.Snippet),h.hasOwnProperty("atom:author")&&e.handleAuthor(h["atom:author"]));e.parseKML(b.kml);u=TGOS.TGKmlLayerStatus.OK;a&&!0==a.preserveViewport&&(b=e.getDefaultViewport())&&g.fitBounds(b);"function"==typeof f&&f.call(e,e,u)}},TGOS.PROXY_SERVICE2,function(){"function"==typeof f&&f.call(this,TGOS.TGKmlLayerStatus.FETCH_ERROR)});this.removeAdvancedLayer=function(){null!=k&&(g.removeIndependentContainer(k),g.removeAdvancedLayer(this),k=null,h=!1)};this.moveToTop=function(){null!=k&&g.moveIndependentContainerToTop(k)}; this.getNode=function(){if(g)return!0==h&&null!=k?[k.div.main,k.div.shadow]:g.getPanes().graphicLayer}};TGOS.RegisterEvent(TGOS.TGKmlLayer,"click mousemove mouseout mouseover dblclick rightclick".split(" "))})();TGOS.TGWmtsLayer=function(){var b=function(b){this.fitBound=b.fitBound;this.matrixSet=b.matrixSet;this.matrixId=b.matrixId;this.row=b.row;this.col=b.col;this.left=b.left;this.top=b.top;this.right=b.right;this.bottom=b.bottom;this.scaledWidth=b.scaledWidth;this.scaledHeight=b.scaledHeight;this.toString=function(){return"{"+this.matrixId+","+this.row+","+this.col+"}"}};b.prototype.equals=function(b){return this.matrixId==b.matrixId&&this.row==b.row&&this.col==b.col};return function(d,a,f,e,g){this.layers= [];this.tileMatrixSets=[];var h=null;a&&(h=a.getPanes().overlayviewLayer);var k=null,l=!1,p=name,m=!0,n=1,u,s=null,q=null,w=null,C=null,B=null,H=null;void 0!==e&&null!==e&&(null!=e.container&&(h=e.container),null!=e.fitDiv&&(fitDiv=e.fitDiv),s="number"==typeof e.left?e.left:null,q="number"==typeof e.top?e.top:null,w="number"==typeof e.right?e.right:null,C="number"==typeof e.bottom?e.bottom:null,n="number"==typeof e.opacity?Math.max(0,Math.min(1,e.opacity)):1,m=!1==e.wmtsVisible?!1:!0);var A=[],l= !1,I=this,G=2.8E-4,D=256;void 0!==f&&(G="number"==typeof f.dpi?25.4/f.dpi/1E3:2.8E-4,D="number"==typeof f.tileWidth?f.tileWidth:256);var J="number"==typeof e.zIndex?e.zIndex:"auto",H=null,K=function(a){var b=document.createElement("div");b.className="TGOS_WMTS";b.style.position="absolute";b.style.left="0px";b.style.top="0px";b.style.width="100%";b.style.height="100%";b.style.zIndex=J;b.style.display=m?"":"none";a.appendChild(b);return b}(h);document.createElement("img");this.moveToTop=function(){h&& (h.removeChild(K),h.appendChild(K))};this.moveLayerTo=function(a){if(h&&K){var b=h.childNodes.length,d=null;a&&(0>a?d=h.firstChild:a>=b||(d=h.childNodes[a]));h.removeChild(K);d?h.insertBefore(K,d):h.appendChild(K)}};this.getNode=function(){return K};this.getLayerId=function(){return p};this.getMatrixSetId=function(){return H["ows:Identifier"]};this.getTileOpacity=function(){return n};this.setTileOpacity=function(a){"number"==typeof a&&(n=a,K&&(K.style.opacity=n,K.style.filter="alpha(opacity="+100* n+")"))};this.getSource=function(){return d};this.setZIndex=function(a){J=a;K&&(K.style.zIndex=J)};this.getZIndex=function(){return J};this.RemoveSelf=function(){h.removeChild(K)};var F=function(){var a=this,b=0;a.style.opacity=b;var d=n/7,e=setInterval(function(){b>=n?(a.style.filter="alpha(opacity="+100*n+")",a.style.opacity=n,clearInterval(e)):(a.style.opacity=b,a.style.filter="alpha(opacity="+100*b+")",b+=d)},33);a.style.filter="alpha(opacity=0)";a.style.display="block"},t=function(a,d,e,f){if(!a)return null; var g;if(a.TileMatrix.length||a.TileMatrix["ows:Identifier"]!=d)for(var h=0;h=k?0:Math.floor((k-m)/p),v=l+Math.ceil(Math.abs(v-m)/p)+1,q,m=1;f&&(m=parseFloat(g.ScaleDenominator)*G/(0.0254*f/96));var t=t-n,s=v-l;f=[];var z=Infinity,u=-Infinity;q=Infinity;for(var w=-Infinity,E=0,A=0,C=[0,-1],v=Math.pow(Math.max(t,s),2);0u&&(u=E),Aw&&(w=A));if(E===A||0>E&&E===-A||0q&&(a.top=q);null!==w&&a.right>w&&(a.right=w);null!==C&&a.bottomf.maxZoom||a==b){f.clearClusters();for(a=0;af.maxZoom){f.clearClusters();for(a=0;athis.maxZoom||a==b){this.clearClusters();for(a=0;athis.maxZoom){this.clearClusters();for(a=0;athis.maxZoom||a==b){this.clearClusters();return}}else if(a>this.maxZoom){this.clearClusters(); return}for(var a=this.getExtendedBounds(),d=0;d=this.clusters[a].symbols.length&&this.addClusterMarker(this.clusters[a])}};l.addClusterMarker=function(a){var b; b=a.centerLonLat?a.centerLonLat:a.center;var d=new TGOS.TGPoint(b.x,b.y);b=a.markers.length;var e=new TGOS.TGMarker(null,d);e.setFlat(!0);e.setClickable(!0);e.setVisible(this.visible);e.setZIndex(this.zIndex);e.setMap(this.map);a.symbols.push(e);if(1g.length-1?g[g.length-1]:g[h];a.symbols[0].setIcon(d.icon);a.symbols[0].setTitle(a.markers.length);a.symbols[1].setFontColor(d.labelColor?d.labelColor:"#f0f0f0");a.symbols[1].setFontSize(d.labelSize?d.labelSize:12);d.labelAnchor&&a.symbols[1].setOffset(d.labelAnchor);break a}d=g[g.length-1];a.symbols[0].setIcon(d.icon);a.symbols[0].setTitle(a.markers.length); a.symbols[1].setFontColor(d.labelColor?d.labelColor:"#f0f0f0");a.symbols[1].setFontSize(d.labelSize?d.labelSize:12);d.labelAnchor&&a.symbols[1].setOffset(d.labelAnchor)}}1==b&&(TGOS.TGEvent.copyEvent(a.markers[0],e),e.setTitle(a.markers[0].getTitle()),e.annotation=a.markers[0].annotation);f&&(f.cluster=a,TGOS.TGEvent.addListener(f,"click",this.clickHandler));e&&(e.cluster=a,TGOS.TGEvent.addListener(e,"click",this.clickHandler))};l.getScaleClass=function(){return this.scaleClass};l.setScaleClass=function(a){this.scaleClass= a};l.setClusterStyle=function(a){this.styles=a};l.getClusterStyle=function(){return this.styles};l.removeMarker=function(a,b){for(var d=0;ds?2*s*s:-1+(4-2*s)*s;nl?0:l>=h?h:l,m=0>d?0:d>k?k:d,k=0>p?0:p>=k?k:p,p=-Infinity,n=Infinity,h=0>b?0:b>h?h:b;hthis.maxIntensity&&(a[h][u]=maxIntensity),p=Math.max(p,a[h][u]),n=Math.min(n,a[h][u]);return{max:p,min:n}};TGOS.TGHeatmapLayer=function(a){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;a&&this.setOptions(a)};TGOS.TGHeatmapLayer.prototype=new TGOS.TGOverlayView;d=TGOS.TGHeatmapLayer.prototype;d.getData=function(){return this.data};d.createKernels=function(){this.kernels=[];for(var b=0;be.height-3&&(f=e.height-3);b.top=f}else f=a.clientX-e.left,f>e.width-3&&(f=e.width-3),b.left=f;b.updateClip_();a.preventDefault&&a.preventDefault();return!1}};AttachEvent(f,"mousedown",a)}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(){b.mapChanged(b)}),this.zoom_changed_=TGOS.TGEvent.addListener(this.map,"zoom_changed",function(){b.mapChanged(b)}),this.tilesloaded_=TGOS.TGEvent.addListener(this.map,"tilesloaded",function(){b.mapChanged(b)}),this.drag_=TGOS.TGEvent.addListener(this.map,"drag",function(){b.mapChanged(b)})):"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(){b.mapChanged(b)}),this.zoom_changed_=TGOS.TGEvent.addListener(this.map,"zoom_changed",function(){b.mapChanged(b)}),this.tilesloaded_=TGOS.TGEvent.addListener(this.map,"tilesloaded",function(){b.mapChanged(b)}),this.drag_=TGOS.TGEvent.addListener(this.map,"drag",function(){b.mapChanged(b)})),a=function(a){AttachEvent(document.body,"mousemove",k);AttachEvent(document.body,"mouseup",h);b.clientX=a.clientX; b.clientY=a.clientY;a.preventDefault&&a.preventDefault();return!1},h=function(a){DetachEvent(document.body,"mousemove",k);DetachEvent(document.body,"mouseup",h);a.preventDefault&&a.preventDefault();return!1},k=function(a){if(b.node&&b.node.parentNode){var e=b.left+(a.clientX-b.clientX),f=b.top+(a.clientY-b.clientY),g=b.node.parentNode.getBoundingClientRect();f>g.height-10&&(f=g.height-10);f<-b.swipeSize+10&&(f=-b.swipeSize+10);e>g.width-10&&(e=g.width-10);e<-b.swipeSize+10&&(e=-b.swipeSize+10);b.node.style.top= f+"px";b.top=f;b.clientY=a.clientY;b.node.style.left=e+"px";b.left=e;b.clientX=a.clientX;b.updateClip_();a.preventDefault&&a.preventDefault();return!1}},AttachEvent(this.node,"mousedown",a)};b.wmtsRefreshed=function(b){b.mapChanged(b)};b.wmsRefreshed=function(b){b.mapChanged(b)};b.mapChanged=function(b){function a(){clearTimeout(f);e=b.updateClip_(e);0b?b:aa.attributes[this.attributeField]&&this.infos[b].minValue<= a.attributes[this.attributeField])return this.infos[b].symbol;return this.defaultSymbol};this.infos=[];if(!b)throw"Default Symbol must be provided";this.defaultSymbol=b;if("string"!=typeof a)throw"Attribute field must be provided";this.attributeField=a}};TGOS.extend(b.Renderer,b.ClassBreaksRenderer);b.ClassBreaksRenderer.prototype.addBreak=function(b){this.infos.push(b)};b.ClassBreaksRenderer.prototype.removeBreak=function(b){b=this.infos.indexOf(b);0<=b&&this.infos.splice(b,1)};return b}();TGOS.request=function(){var b={},d=0,a=function(a){var b=document.createElement("form");b.setAttribute("method",a.method?a.method:"POST");b.setAttribute("enctype","multipart/form-data");b.setAttribute("encoding","multipart/form-data");for(var d in a.data){var e=document.createElement("input");e.type="hidden";e.name=d;e.value=a.data[d];b.appendChild(e)}a=document.createElement("input");a.type="submit";b.appendChild(a);document.body.appendChild(b);return b};b.iframe=function(b,e){var f="sgIFrame"+d, l=document.createElement("iframe");l.setAttribute("id",f);l.setAttribute("name",f);l.setAttribute("width","0");l.setAttribute("height","0");l.setAttribute("border","0");l.setAttribute("style","width: 0; height: 0; border: none;");var p=e.form?e.form:a(e);document.body.appendChild(l);var m=document.getElementById(f),n=function(){m.detachEvent?m.detachEvent("onload",n):m.removeEventListener("load",n,!1);m.contentDocument?content=m.contentDocument.body.innerHTML:m.contentWindow?content=m.contentWindow.document.body.innerHTML: m.document&&(content=m.document.body.innerHTML);e.callback&&e.callback.call(this,JSON.parse(content));m.parentNode.removeChild(m)};m.addEventListener&&m.addEventListener("load",n,!0);m.attachEvent&&m.attachEvent("onload",n);p.setAttribute("target",f);p.setAttribute("action",b);p.submit();d++};var f=function(a,b,d){return 0<=a.indexOf("?")?a+"&"+b+"="+d:a+"?"+b+"="+d};b.getJSON=function(a,d,e,l){var p=DeviceTest();"number"!=typeof b.ajaxCount__&&(b.ajaxCount__=0);var m="sn"+b.ajaxCount__;TGOS.request.getJSON[m]= function(){d.apply(this,arguments);delete TGOS.request.getJSON[m]};e&&(a=f(e,"serv",encodeURIComponent(a)));a=f(a,"jsonp",encodeURIComponent("TGOS.request.getJSON['"+m+"']"));e=document.getElementsByTagName("head");if(0!=e.length){var n=document.createElement("script");n.type="text/javascript";"MSIE"==p?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(){l&&l.call(this);this.parentNode.removeChild(n);n=void 0};b.ajaxCount__++;n.src=a;e[0].appendChild(n)}};var e=function(a,b,d){4==a.readyState&&(200!=a.status&&304!=a.status?d&&d.call(this,a.status):b&&b.call(this,a))};b.ajax=function(a,b){var d;d=window.XMLHttpRequest?new XMLHttpRequest:window.ActiveXObject?new ActiveXObject("Microsoft.XMLHTTP"):void 0;var f="get",p=!1,m=null,n=null,u=null,s=null,q=null;b&&("post"===b.method&&(f="post"),!1===b.async&&(p=!1),!1===b.async&& (m=null),b.user&&(n=b.user),b.password&&(u=b.password),b.error&&(s=b.error),b.complete&&(q=b.complete));d.open(f,a,p,n,u);m&&d.setRequestHeader("Content-type","application/x-www-form-urlencoded");!0===p&&(d.onreadystatechange=function(a){e(d,q,s)});4!=d.readyState&&(d.send(m),!1===p&&e(d,q,s))};b.get=function(a,d){d.method="get";b.ajax.call(this,a,d)};b.post=function(a,d){d.method="post";b.ajax.call(this,a,d)};return b}();(function(){var b=/\${[\w:]*}/g,d;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(a,d){var e=d.match(b);if(e)for(var g=0;g=h.length?k=a.attributes[h[0]]?a.attributes[h[0]]:"":window[h[1]]&&(k=window[h[1]].call(this,a.attributes[h[0]],h[0],a.attributes));d=d.replace(e[g],k)}return d};this.add=function(a){a&&(a.layer=this,a.draw(this.map_,new TGOS.TGPoint(a.attributes.longitude,a.attributes.latitude)),this.graphics.push(a),TGOS.TGEvent.trigger(a,"graphic-add"))};this.clear=function(){for(var a=0;athis.minScale)&&b};this.setMaxScale=function(a){"number"==typeof a&&(this.maxScale=a,this.map_&&(a=this.map_.getMapBase().getScale(), this.isVisibleAtScale(a)||(this.node.style.visibility="hidden")))};this.setMinScale=function(a){"number"==typeof a&&(this.minScale=a,this.map_&&(a=this.map_.getMapBase().getScale(),this.isVisibleAtScale(a)||(this.node.style.visibility="hidden")))};this.setVisibility=function(a){"boolean"==typeof a&&(this.node&&(this.node.style.visibility=a?"visible":"hidden"),this.visible=a)};this.setRenderer=function(a){this.renderer=a;this.map_&&this.redraw()};this.redraw=function(){for(var a=0;athis.opacity&&(this.opacity=0),1=a.length)return!1;f=d;if(1==l)for(;df&&(f=0);f>this.maxDataValue&&(f=this.maxDataValue);if(this.ColorArry){var e=this.CompareValue(a);this.color=e?e:"#88ff33"}else 0.33>=a/this.maxDataValue? this.color=this.lowColor:0.66>=a/this.maxDataValue?this.color=this.midColor:1>=a/this.maxDataValue&&(this.color=this.highColor);var g=this.angle,h=180*(1-f/this.maxDataValue),k=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=a+" "+this.unitLabel;isNaN(f)?(a=b.createPathStr(180,b.outRadius,b.inRadius,b.cx,b.cy),b.path.attr({path:a}),this.angle=180):(this.animation=TGOS.fx.createAnimation({easing:TGOS.fx.easing.quadInOut, type:window.requestAnimationFrame?"":"setTimeout",duration:150,onAnimation:function(a){b.angle=g+k*a;a=b.createPathStr(b.angle,b.outRadius,b.inRadius,b.cx,b.cy);b.path.attr({fill:b.color});b.path.attr({path:a})},onEnd:function(){var a=b.createPathStr(h,b.outRadius,b.inRadius,b.cx,b.cy);b.path.attr({path:a})}}),this.animation.play())}};b.setCaption=function(b){"string"==typeof b&&(this.caption=b,this.captionSpan&&(this.captionSpan.innerHTML=b))};b.setTitle=function(b){"string"==typeof b&&(this.title= b,this.titleSpan&&(this.titleSpan.innerHTML=b))};b.setLabel=function(b){"string"==typeof b&&(this.label=b,this.labelSpan&&(this.labelSpan.innerHTML=b))};b.setValue=function(b){"number"==typeof b&&(this.value=b,this.valueSpan&&(this.valueSpan.innerHTML=b,this.valueSpan.style.left=this.cx-this.valueSpan.clientWidth/2+"px",this.valueSpan.style.top=this.cy))};b.setFeature=function(b){b instanceof TGOS.Graphic&&(this.feature=b,this.update())};b.startup=function(){for(var b=this,a=0;a=f.MinValue&&bb.length))return b[0]};this.parseRing=function(a,b){switch(b){case "EPSG3826":var d=this.parseCoordinates(a.coordinates,"EPSG3826");break;case "EPSG3825":d=this.parseCoordinates(a.coordinates,"EPSG3825");break;case "EPSG3857":d=this.parseCoordinates(a.coordinates,"EPSG3857")}d=new TGOS.TGLineString(d);return new TGOS.TGLinearRing(d)};this.createPolygon= function(a){var b=[],d=this.parseRing(a.outerBoundaryIs.LinearRing,s);b.push(d);var e=a.innerBoundaryIs;if(e)if(e.length)for(var f=0;fa.r&&(b="0"+b);var d=a.g.toString(16);16>a.g&&(d="0"+d);var e=a.b.toString(16);16>a.b&&(e="0"+e);return"#"+b+d+e}};this.handlePlacemark=function(a,b){var d=[];if(a.length)for(var e=0;e");0";for(b=0;b",f=f+"",f=f+"", f=f+"";f+="
",f=f+(t||d),f=f+"",f=f+m,f=f+"
"}if(g.SchemaData)for(g=g.SchemaData.length?g.SchemaData:[g.SchemaData],h=0;h";for(b=0;b",f+="",f+="",f+="";f+="
", f+=n+":"+d,f+="",f+=void 0===m?"":m,f+="
"}}}0e&&h.substr(0,e)==d){var k=a[h];void 0!==k&&b(k,d);delete a[h];h=h.replace(d,"");a[h]=k}}}if(!a||a.error)w=TGOS.TGKmlLayerStatus.FETCH_ERROR, "function"==typeof h&&h.call(this,w);else{var d=a.kml;void 0==d&&(d=a["kml:kml"],void 0!==d&&b(d,"kml:"));d.Document?(d.Document.hasOwnProperty("description")&&null!=d.Document.description&&(d.Document.description.hasOwnProperty("#cdata-section")?q.description=d.Document.description["#cdata-section"]:q.description=d.Document.description),d.Document.hasOwnProperty("name")&&null!=d.Document.name&&(d.Document.name.hasOwnProperty("#cdata-section")?q.name=d.Document.name["#cdata-section"]:q.name=d.Document.name), d.Document.hasOwnProperty("Snippet")&&null!=d.Document.Snippet&&(d.Document.Snippet.hasOwnProperty("#cdata-section")?q.snippet=d.Document.Snippet["#cdata-section"]:q.snippet=d.Document.Snippet),d.Document.hasOwnProperty("atom:author")&&k.handleAuthor(d.Document["atom:author"]),k.Schema=d.Document.Schema):(d.hasOwnProperty("description")&&null!=d.description&&(d.description.hasOwnProperty("#cdata-section")?q.description=d.description["#cdata-section"]:q.description=d.description),d.hasOwnProperty("name")&& null!=d.name&&(d.name.hasOwnProperty("#cdata-section")?q.name=d.name["#cdata-section"]:q.name=d.name),d.hasOwnProperty("Snippet")&&null!=d.Snippet&&(d.Snippet.hasOwnProperty("#cdata-section")?q.snippet=d.Snippet["#cdata-section"]:q.snippet=d.Snippet),d.hasOwnProperty("atom:author")&&k.handleAuthor(d["atom:author"]));k.parseKML(d);w=TGOS.TGKmlLayerStatus.OK;g&&!0==g.preserveViewport&&(a=k.getDefaultViewport())&&l.fitBounds(a);"function"==typeof h&&h.call(k,w)}},f,function(){"function"==typeof h&&h.call(this, TGOS.TGKmlLayerStatus.FETCH_ERROR)});this.removeAdvancedLayer=function(){null!=m&&(l.removeIndependentContainer(m),l.removeAdvancedLayer(this),m=null,p=!1)};this.moveToTop=function(){null!=m&&l.moveIndependentContainerToTop(m)};this.getNode=function(){if(l)return!0==p&&null!=m?[m.div.main,m.div.shadow]:l.getPanes().graphicLayer}};TGOS.RegisterEvent(TGOS.KMLLayer,"click mousemove mouseout mouseover dblclick rightclick".split(" "))})();TGOS=TGOS||{}; (function(){var b=function(b){this.left=b.left;this.top=b.top;this.right=b.right;this.bottom=b.bottom;this.src=b.src;this.width=b.width;this.height=b.height;this.layer=b.layer;this.cancel=this.loaded=!1;this.node=document.createElement("img");this.node.style.position="absolute";this.setSource=function(a){this.loaded=!1;this.node.src=a};var a=this;this.node.onload=function(){a.cancel?a.loaded=!1:(a.loaded=!0,b.onload&&b.onload.call(a))};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(d,a,f,e,g,h){function k(){if(n){var a=m.getClientWidth(),b=m.getClientHeight(),d=m.ToMapPoint(0,0),e=m.ToMapPoint(a,b);l();var f=null,f=null!=B?B+"="+I:"1.3.0"==A?"CRS="+I:"SRS="+I;switch(n.getCoordSys()){case TGOS.TGCoordSys.EPSG3857:d=TGOS.GooToWGS84(d.x,d.y);e=TGOS.GooToWGS84(e.x,e.y);break;case TGOS.TGCoordSys.EPSG3826:0> I.indexOf("3826")&&(0<=I.indexOf("3825")?(d=TGOS.TWD97toTWD97_119(d.x,d.y),e=TGOS.TWD97toTWD97_119(e.x,e.y)):0<=I.indexOf("4326")&&(d=TGOS.TWD97toWGS84(d.x,d.y),e=TGOS.TWD97toWGS84(e.x,e.y)));break;case TGOS.TGCoordSys.EPSG3825:0>I.indexOf("3825")&&(0<=I.indexOf("3826")?(d=TGOS.TWD97_119toTWD97(d.x,d.y),e=TGOS.TWD97_119toTWD97(e.x,e.y)):0<=I.indexOf("4326")&&(d=TGOS.TWD97_119toWGS84(d.x,d.y),e=TGOS.TWD97_119toWGS84(e.x,e.y)))}var g=d.x,h=e.y,k=e.x,t=d.y;"1.3.0"==A&&0>I.indexOf("CRS:84")&&0<=I.indexOf("EPSG:4326")&& (g=e.y,h=d.x,k=d.y,t=e.x);a=p+"?BBOX="+(g+","+h+","+k+","+t)+"&WIDTH="+a+"&HEIGHT="+b;a+="&"+F.join("&");a+="&"+f;s&&(a=s+"?"+a);return a}}function l(){if(n){var a=m.getClientWidth(),b=m.getClientHeight(),d=m.ToMapPoint(0,0),e=m.ToMapPoint(a,b);return{left:d.x,top:d.y,right:e.x,bottom:e.y,width:a,height:b}}}var p,m,n=f,u=!0,s,q="auto",w,C=1,B=null,H=f.getPanes().overlayviewLayer;g&&(void 0!==g.opacity&&"number"==typeof g.opacity&&(C=g.opacity),void 0!==g.visible&&"boolean"==typeof g.visible&&(u=g.visible), void 0!==g.container&&(H=g.container),void 0!==g.proxy&&(s=0=a?d=H.firstChild:a>=b||(d=H.childNodes[a]);H.removeChild(layerContainer);d?H.insertBefore(layerContainer,d):H.appendChild(layerContainer)}}};this.RemoveSelf=function(){H&&t&&H.removeChild(t)}; this.getLayerId=function(){return d};this.getNode=function(){return t};this.getDefaultViewport=function(){};this.getUrl=function(){return p};this.removeLayer=function(){n.removeLayer(this)};this.getZIndex=function(){return q};this.setZIndex=function(a){q=a;t&&(t.style.zIndex=q)};this.getVisible=function(){return u};this.setVisible=function(a){u=a;t&&(t.style.display=u?"block":"none")};this.putVisible=function(a){this.setVisible(a)};this.setProxy=function(a){a&&(s=0>>0;if("function"!==typeof b)throw new TypeError("predicate must be a function");for(var g=0;g>>0;a>>=0;a=0>a?Math.max(g+a,0):Math.min(a,g);f=void 0===f?g:f>>0;for(g=0>f?Math.max(g+f,0):Math.min(f,g);a=this.length?null:this.find(a)||this[0]}function p(){return!this||0>=this.length?null:this[this.push(this.shift())-1]}function m(a){if(!t)return null;var b=k(t.TileMatrix,null);if(!b||0>=b.length)return null;var d=a.ToMapDistX(1)/ (0.0254/e.dpi);return(a=b.map(function(a){return{m:a,d:Math.abs(Math.log(parseFloat(a.ScaleDenominator)/d))}}).reduce(function(a,b){return a&&a.d=w.childNodes.length||(a=parseInt(a),isNaN(a)||(0>a&&(a+=w.childNodes.length+1),w.insertBefore(L,a=a?d=q.firstChild:a>=b||(d=q.childNodes[a]);q.removeChild(P);d?q.insertBefore(P,d):q.appendChild(P)}}};this.getLayerId= function(){return f};this.getOpacity=function(){return H};this.setOpacity=function(a){"number"==typeof a&&(H=a,P&&(P.style.opacity=H,P.style.filter="alpha(opacity="+100*H+")"))};this.getZIndex=function(){return A};this.setZIndex=function(a){A=a;P&&(P.style.zIndex=A)};this.getSourceUrl=function(){return e};this.getNode=function(){return P};this.RemoveSelf=function(){q&&P&&q.removeChild(P)};var U=function(a,d,f){if(!a)return null;for(var h,k=0;kf&&(f=k),lh&&(h=l));if(k===l||0>k&&k===-l||0=a?0:Math.floor((a-v)/h),v=l+Math.ceil(Math.abs(q-v)/h)+1,v=k(s-z,v-l),k=v.xy,0D&&(a.top=D);null!==J&&a.right>J&&(a.right=J);null!==K&&a.bottomh&&(f.x-=h=-h);0>g&&(f.y-=g=-g);d[e].ReloadStatus(f.x,f.y,h,g)}};this.UpdateElement=function(){this.RebuildElement()};this.RebuildElement=function(){if(E&&I&&B){var a=Y(z,B);if(null!=a){var b=z.ToMapPoint(0,0),d=z.ToMapPoint(z.getClientWidth(),z.getClientHeight()),b=new TGOS.TGEnvelope(b.x,b.y,d.x,d.y),b=M(b);U(B,a,b);DEBUG_MODE&&console.log("getBoundTiles = "+t.length);var d=[],e=t.length;for(i=0;ib.right||m>b.top||l=this.maxFeaturesAllow&&(w=!1,m=!0,this.setWarningText(this.textTooManyGraphics));if(w){var w=!1,C=q.geom.Envelope;null!=C&&(C.left>p.right||C.rightp.top||C.top=p.count&&(void 0!==p.symbol&&null!=p.symbol&&(p.symbol.setMap(null),p.symbol=null),delete a[l]))}}};this.setVisible=function(a,b,d,f){b=a+"_"+b;a=null;if(void 0!==this.mFeatures[b]){a=this.mFeatures[b];b=d.length;for(var l=0;l"),k=k+s+": "+u,l.push({field:s,value:u})))}else for(n in d.attr)u=d.attr[n],void 0!==u&&(0"),k=k+n+": "+u,l.push({field:n,value:u}));f.graphicSelectedCallback?f.graphicSelectedCallback.call(b,{graphic:b,point:a.point,info:k,attr:l}):(null==f.messageBox&& (f.messageBox=new TGOS.TGInfoWindow(null,null,f.infoWindowOptions)),f.messageBox.setPosition(a.point),f.messageBox.setMessageText(k),f.messageBox.open(f.map))}}};this.hideInfo=function(){null!=f.messageBox&&(f.messageBox.setMessageText(""),f.messageBox.close())};this.setQueryable=function(a){this.queryable=a;for(var b in this.mFeatures){var d=this.mFeatures[b];if(void 0!==d)for(var k in d){var l=d[k];void 0!==l&&(l=l.symbol,void 0!==l&&(a?(TGOS.TGEvent.addListener(l,"click",f.showInfo),l.setCursor("pointer")): (void 0!==l.click_&&TGOS.TGEvent.removeListener(l.click_[0]),l.setCursor("default"))))}}};this.getQueryable=function(){return this.queryable}};TGOS.TGVectorTile=function(d,a){this.req=this.url=this.map=null;this.loaded=this.loading=!1;this.matrixSet=d.matrixSet;this.matrixId=d.matrixId;this.bound=d.bound;this.row=d.row;this.col=d.col;this.format=d.format;this.visible=!0;this.fid=[];this.equals=function(a){return this.matrixSet==a.matrixSet&&this.matrixId==a.matrixId&&this.row==a.row&&this.col==a.col}; this.setVisible=function(b){this.visible=b;if(0J&&(J=0);1=n?0:Math.floor((n-l)/v),l=k+Math.ceil(Math.abs(t-l)/v)+1,m=m-d,q=l-k,l=[],s=Infinity,u=-Infinity,z=Infinity,E=-Infinity,w=0,A=0,B=[0,-1],t=Math.pow(Math.max(m,q),2);0u&&(u=w),AE&&(E=A));if(w===A||0>w&&w===-A||0f&&(e.intCoord=!0);var g=a.format.indexOf("gml"),h=a.format.indexOf("json");0<=g||0<=f?(b=TGOS.parseXML(b),a.getGmlFeature(b,e)):0<=h&&(b=JSON.parse(b),a.getJsonFeature(b,e))}}};a.xhr=d;d.open("GET", a.url,!0);d.send()}},L;this.finished=!1;this.UpdateElement=function(){if(H&&K&&F&&(this.getAllFeatures().showWarning(!1),this.finished)){var a=z(B,F);if(null!=a){var b=F["ows:Identifier"],d=a["ows:Identifier"],g=B.ToMapPoint(0,0),h=B.ToMapPoint(B.getClientWidth(),B.getClientHeight()),g=h=new TGOS.TGEnvelope(g.x,g.y,h.x,h.y);null!==n&&g.leftu&&(g.top=u);null!==s&&g.right>s&&(g.right=s);null!==q&&g.bottomh.right||t.righth.top||t.top=l.count&&(void 0!==l.symbol&&null!=l.symbol&&(l.symbol.setMap(null),l.symbol=null),delete a[k]))}}};this.setVisible= function(a,b,d,h){b=a+"_"+b;a=null;if(void 0!==this.mFeatures[b]){a=this.mFeatures[b];b=d.length;for(var k=0;k"),h=h+u+": "+n,k.push({field:u,value:n})))}else for(m in g.attr)n=g.attr[m],void 0!==n&&(0"),h=h+m+": "+n,k.push({field:m,value:n}));a.graphicSelectedCallback?a.graphicSelectedCallback.call(d,{graphic:d,point:b.point,info:h,attr:k}):(null==a.messageBox&&(a.messageBox=new TGOS.TGInfoWindow(null,null,a.infoWindowOptions)),h=''+ h+"",a.messageBox.setPosition(b.point),a.messageBox.setMessageText(h),a.messageBox.open(a.map))}}};this.hideInfo=function(){null!=a.messageBox&&(a.messageBox.setMessageText(""),a.messageBox.close())};this.setQueryable=function(b){this.queryable=b;for(var d in this.mFeatures){var g=this.mFeatures[d];if(void 0!==g)for(var h in g){var k=g[h];void 0!==k&&(k=k.symbol,void 0!==k&&(b?(TGOS.TGEvent.addListener(k,"click",a.showInfo),k.setCursor("pointer")):(void 0!==k.click_&&TGOS.TGEvent.removeListener(k.click_[0]), k.setCursor("default"))))}}};this.getQueryable=function(){return this.queryable}};TGOS.TGVectorTilePoi=function(d,a){this.req=this.url=this.map=null;this.loaded=this.loading=!1;this.matrixSet=d.matrixSet;this.matrixId=d.matrixId;this.bound=d.bound;this.row=d.row;this.col=d.col;this.format=d.format;this.visible=!0;this.fid=[];this.equals=function(a){return this.matrixSet==a.matrixSet&&this.matrixId==a.matrixId&&this.row==a.row&&this.col==a.col};this.setVisible=function(b){this.visible=b;if(0=h.length)){for(var d=void 0!==b?b*b:1,k=h[0],l=[k],p,m=1,n=h.length;md&&(l.push(p),k=p)}k!==p&&l.push(p);p=l;var h=p.length,k=new ("undefined"!== typeof Uint8Array?Uint8Array:Array)(h),l=0,m=h-1,n=[],u=[],q,w,C;for(k[l]=k[m]=1;m;){q=0;for(s=l+1;sq&&(C=s,q=w)}q>d&&(k[C]=1,n.push(l,C,C,m));m=n.pop();l=n.pop()}for(s=0;soa&&(oa=0);1=m?0:Math.floor((m-k)/n);for(k=l+Math.ceil(Math.abs(e-k)/n)+1;lu&&(f.top=u);null!==s&&f.right>s&&(f.right=s);null!==q&&f.bottomk.right||l.rightk.top||l.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.defaultPorts={http:"80",https:"443",ftp:"21", gopher:"70",ws:"80",wss:"443"};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(a){if(a&&a.nodeName){var b=a.nodeName.toLowerCase();return"input"===b&&"image"!==a.type?void 0:e.domAttributes[b]}};e.encode=s;e.decode=decodeURIComponent;e.iso8859=function(){e.encode=escape; e.decode=unescape};e.unicode=function(){e.encode=s;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(a,b){var d=e.encode(a+"");void 0===b&&(b=e.escapeQuerySpace);return b?d.replace(/%20/g,"+"):d};e.decodeQuery=function(a,b){a+="";void 0=== b&&(b=e.escapeQuerySpace);try{return e.decode(b?a.replace(/\+/g,"%20"):a)}catch(d){return a}};var A={encode:"encode",decode:"decode"},I,G=function(a,b){return function(d){try{return e[b](d+"").replace(e.characters[a][b].expression,function(d){return e.characters[a][b].map[d]})}catch(f){return d}}};for(I in A)e[I+"PathSegment"]=G("pathname",A[I]),e[I+"UrnPathSegment"]=G("urnpath",A[I]);A=function(a,b,d){return function(f){var g;g=d?function(a){return e[b](e[d](a))}:e[b];f=(f+"").split(a);for(var h= 0,k=f.length;he)return a.charAt(0)===b.charAt(0)&&"/"===a.charAt(0)?"/":"";if("/"!==a.charAt(e)||"/"!==b.charAt(e))e=a.substring(0,e).lastIndexOf("/");return a.substring(0,e+1)};e.withinString=function(a,b,d){d||(d={}); var f=d.start||e.findUri.start,g=d.end||e.findUri.end,h=d.trim||e.findUri.trim,k=d.parens||e.findUri.parens,l=/[a-z0-9-]=["']?$/i;for(f.lastIndex=0;;){var m=f.exec(a);if(!m)break;var n=m.index;if(d.ignoreHtml){var p=a.slice(Math.max(n-3,0),n);if(p&&l.test(p))continue}for(var q=n+a.slice(n).search(g),p=a.slice(n,q),q=-1;;){var s=k.exec(p);if(!s)break;q=Math.max(q,s.index+s[0].length)}p=-1d.length)return this._parts.hostname;d=this._parts.hostname.length-this.tld(b).length-1;d=this._parts.hostname.lastIndexOf(".",d-1)+1;return this._parts.hostname.substring(d)||""}if(!a)throw new TypeError("cannot set domain empty");e.ensureValidHostname(a);!this._parts.hostname|| this.is("IP")?this._parts.hostname=a:(d=RegExp(g(this.domain())+"$"),this._parts.hostname=this._parts.hostname.replace(d,a));this.build(!b);return this};B.tld=function(b,d){if(this._parts.urn)return void 0===b?"":this;"boolean"===typeof b&&(d=b,b=void 0);if(void 0===b){if(!this._parts.hostname||this.is("IP"))return"";var e=this._parts.hostname.lastIndexOf("."),e=this._parts.hostname.substring(e+1);return!0!==d&&a&&a.list[e.toLowerCase()]?a.get(this._parts.hostname)||e:e}if(b)if(b.match(/[^a-zA-Z0-9-]/))if(a&& a.is(b))e=RegExp(g(this.tld())+"$"),this._parts.hostname=this._parts.hostname.replace(e,b);else throw new TypeError('TLD "'+b+'" 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");e=RegExp(g(this.tld())+"$");this._parts.hostname=this._parts.hostname.replace(e,b)}else throw new TypeError("cannot set TLD empty");this.build(!d);return this};B.directory=function(a,b){if(this._parts.urn)return void 0===a? "":this;if(void 0===a||!0===a){if(!this._parts.path&&!this._parts.hostname)return"";if("/"===this._parts.path)return"/";var d=this._parts.path.length-this.filename().length-1,d=this._parts.path.substring(0,d)||(this._parts.hostname?"/":"");return a?e.decodePath(d):d}d=this._parts.path.length-this.filename().length;d=this._parts.path.substring(0,d);d=RegExp("^"+g(d));this.is("relative")||(a||(a="/"),"/"!==a.charAt(0)&&(a="/"+a));a&&"/"!==a.charAt(a.length-1)&&(a+="/");a=e.recodePath(a);this._parts.path= this._parts.path.replace(d,a);this.build(!b);return this};B.filename=function(a,b){if(this._parts.urn)return void 0===a?"":this;if("string"!==typeof a){if(!this._parts.path||"/"===this._parts.path)return"";var d=this._parts.path.lastIndexOf("/"),d=this._parts.path.substring(d+1);return a?e.decodePathSegment(d):d}d=!1;"/"===a.charAt(0)&&(a=a.substring(1));a.match(/\.?\//)&&(d=!0);var f=RegExp(g(this.filename())+"$");a=e.recodePath(a);this._parts.path=this._parts.path.replace(f,a);d?this.normalizePath(b): this.build(!b);return this};B.suffix=function(a,b){if(this._parts.urn)return void 0===a?"":this;if(void 0===a||!0===a){if(!this._parts.path||"/"===this._parts.path)return"";var d=this.filename(),f=d.lastIndexOf(".");if(-1===f)return"";d=d.substring(f+1);d=/^[a-z0-9%]+$/i.test(d)?d:"";return a?e.decodePathSegment(d):d}"."===a.charAt(0)&&(a=a.substring(1));if(d=this.suffix())f=a?RegExp(g(d)+"$"):RegExp(g("."+d)+"$");else{if(!a)return this;this._parts.path+="."+e.recodePath(a)}f&&(a=e.recodePath(a), this._parts.path=this._parts.path.replace(f,a));this.build(!b);return this};B.segment=function(a,b,d){var e=this._parts.urn?":":"/",f=this.path(),g="/"===f.substring(0,1),f=f.split(e);void 0!==a&&"number"!==typeof a&&(d=b,b=a,a=void 0);if(void 0!==a&&"number"!==typeof a)throw Error('Bad segment "'+a+'", must be 0-based integer');g&&f.shift();0>a&&(a=Math.max(f.length+a,0));if(void 0===b)return void 0===a?f:f[a];if(null===a||void 0===f[a])if(k(b)){f=[];a=0;for(var h=b.length;a\x3c/script>");document.write("