📄 supermap.is.mapcontrol.js
字号:
// 功能: Ajax MapControl 类
// 最后修改时间: 2006-05-25
//==========================================================================
SuperMap.IS.MapControl=function(container,params){var av=null;var referViewBounds=null;var referScale=0;var referViewer=null;var mapBounds=null;var ch="";var fi="png";var cz="http://localhost/mapHandler";var bu=0;var ab=5;var ez=15;var gk=15;var lt="images/spacer.gif";var k=256;var gj=1;var gi=2;var dy=11;var jn=20;var gw=this;var ay=true;var a=new SuperMap.IS.MapParam();var ae=new SuperMap.IS.MapParam();var fd=1;var kl=0,kk=0,dx=0,dt=0;var o=new Array();var bn=null;var ap=new Array();var x11=0,w=0;var aa=0,z=0;var bl=0,bk=0,cd=0,cc=0;var j=0,ad=0;var ke=false;var ci=false;var ls=0,lr=0;var ak=false;var aj=0;var bi=false;var da=0;var dh=0,dg=0;var en=null,eo=null;var em=null;var bc=null;var bp=null;var d=null;var gb=null;var r=null;var el=null;var bh=new Array();var ja=false;var i1=document.createElement("div");var bo=document.createElement("input");bo.id="kbInput";this.container=container;this.mapDiv=i1;var ai=new Array();var ax=new Array();var q=new Array();var m=new Array();var dr=128;var dz=false;var ha=false;this.Init=function(){window.curMapControl=gw;if(params.imageFormat){fi=params.imageFormat;};if(params.mapHandler){cz=params.mapHandler;};if(params.mapName){ch=params.mapName;};if(params.mapScales){av=params.mapScales;};if(params.useImageBuffer){dz=params.useImageBuffer;};gb=new mo();gb.Init();if(!ha){aq("onerror",new EventArguments(null,"地图初始化失败,请检查地图名是否正确,MapHandler 是否已正确配置,远程服务是否已启动。"));return false;};cu();if(dx<100){container.style.width="100px";}if(dt<100){container.style.height="100px";};cu();container.style.overflow="hidden";container.style.padding="0px";container.style.margin="0px";i1.style.position="relative";i1.style.padding="0px";i1.style.margin="0px";i1.style.zIndex=1;container.appendChild(i1);var ga=bo.style;ga.position="absolute";ga.top=(kk+dt/2)+"px";ga.left=(kl+dx/2)+"px";ga.width="0px";ga.height="0px";ga.padding="0px";ga.margin="0px";ga.border="0px solid white";ga.zIndex=-1;ga=null;container.appendChild(bo);if(!params.fixedView){bc=new SuperMap.IS.ZoomInAction();bc.Init(gw);bp=new SuperMap.IS.PanAction();bp.Init(gw);d=bp;container.attachEvent("onmousedown",gv);container.attachEvent("onmouseup",it);container.attachEvent("onmousemove",gu);container.attachEvent("onmousewheel",bv);container.attachEvent("ondblclick",hq);container.attachEvent("oncontextmenu",fk);container.attachEvent("onclick",ki);bo.attachEvent("onkeydown",iu);bo.attachEvent("onkeyup",kj);if(window.addEventListener&&navigator.product&&navigator.product=="Gecko"){container.addEventListener("DOMMouseScroll",bv,false);};bu=k;};if(params.buffer!=undefined&¶ms.buffer!=null){bu=params.buffer;};if(params.x&¶ms.y&¶ms.zoomLevel){try{var la=new SuperMap.IS.MapParam(ch,av);la.SetZoomLevel(eval(params.zoomLevel));la.SetMapCenter(new SuperMap.IS.MapCoord(params.x,params.y));t(la);}catch(e){dw();};}else{dw();};if(!params.disableLogo){em=new mg(container);em.Init();};_EnableVML();};this.Destroy=function(){window.curMapControl=null;ha=false;while(m.length>0){var ed=m[0];delete m[ed];m.shift();}m=null;if(!params.fixedView){container.detachEvent("onmousedown",gv);container.detachEvent("onmouseup",it);container.detachEvent("onmousemove",gu);container.detachEvent("onmousewheel",bv);container.detachEvent("ondblclick",hq);container.detachEvent("oncontextmenu",fk);container.detachEvent("onclick",ki);bo.detachEvent("onkeydown",iu);bo.detachEvent("onkeyup",kj);};bo=null;while(o.length>0){var bb=o.pop();bb.ao();}o=null;while(ap.length>0){ap.pop().ao();}ap=null;if(em){em.Destroy();em=null;};if(gb){gb.Destroy();gb=null;};if(bc){bc.Destroy();bc=null;};if(bp){bp.Destroy();bp=null;};if(d){d.Destroy();d=null;};fx();ai=null;fw();ax=null;eg();q=null;iv();this.i1=null;this.container=null;i1=container=gw=null;};function cu(){kl=_GetElementX(container);kk=_GetElementY(container);if(container.style.borderLeftWidth){kl+=parseInt(container.style.borderLeftWidth);};if(container.style.borderTopWidth){kk+=parseInt(container.style.borderTopWidth);};dx=container.offsetWidth;dt=container.offsetHeight;};function dw(){var ln=new SuperMap.IS.MapParam(ch,av);ln.SetMapCenter(new SuperMap.IS.MapCoord(0.0,0.0));ln.SetZoomLevel(1);t(ln);};function hk(){return a.mapCenter.x;};function hj(){return a.mapCenter.y;};function gg(){return a.pixelCenter.x;};function gf(){return a.pixelCenter.y;};function fh(cn){a.mapCenter=r.PixelToMapCoord(a.pixelCenter,a.zoomLevel);if(cn){ae.Copy(a);}};function ia(){return a.zoomLevel;};function ba(io){var ly=r.MapCoordToPixel(io,a.zoomLevel);ly.x-=x11+aa;ly.y-=w+z;return ly;};function ck(ly){var mv=new SuperMap.IS.PixelCoord(ly.x+x11+aa,ly.y+w+z);var io=r.PixelToMapCoord(mv,a.zoomLevel);return io;};function as(ms,dv){return r.PixelToMapDistance(ms,dv);};function ks(){return new SuperMap.IS.PixelRect(0,0,dx,dt);};function lc(width,height){if((!width||width<=0)&&(!height||height<=0)){return;};if(width&&width>0){dx=width;}if(height&&height>0){dt=height;};container.style.width=dx+"px";container.style.height=dt+"px";gt(a);if(em){em.er();};aq("onresize");};function eu(ec){ay=ec;};function fg(){return ay;};function iy(ec){ja=ec;for(var h=0;h<o.length;h++){o[h].Debug(ec);}};function ff(ln,ag){du(ln,ag,0,0);};function du(ln,ag,ac,p){var hr=r.PixelToMapCoord(new SuperMap.IS.PixelCoord(ac+ln.pixelCenter.x,p+ln.pixelCenter.y),ln.zoomLevel);if(ja){window.status="oldX:"+hr.x;};var ar=false;if(hr.x<ag.leftBottom.x){hr.x=ag.leftBottom.x;ar=true;};if(hr.y<ag.leftBottom.y){hr.y=ag.leftBottom.y;ar=true;};if(hr.x>ag.rightTop.x){hr.x=ag.rightTop.x;ar=true;};if(hr.y>ag.rightTop.y){hr.y=ag.rightTop.y;ar=true;};if(ar){var iz=r.MapCoordToPixel(hr,ln.zoomLevel);ln.SetPixelCenter(iz);}else{ln.SetPixelCenter(new SuperMap.IS.PixelCoord(ln.pixelCenter.x+ac,ln.pixelCenter.y+p));};ln.SetMapCenter(hr);if(ja){window.status+="newX:"+hr.x;};return;};function lx(ah,ne,kc,dv,km,kf){var le=r.PixelToMapDistance(dv);var mk=(kc+ah)*le;if(mk>kf){return ah*(kf/mk);}else if(mk<km){return ah*(mk/km);};return ah;};function fu(bm,dv,gn,e){var ln=a.MakeCopy();if(bm){ln.mapCenter=bm;};if(dv){ln.zoomLevel=dv;};if(!gn){gn="";};return new EventArguments(ln,gn,e);};function ix(event,eq){var i=bh[event];if(!i){i=new Array();bh[event]=i;}for(var h=0;h<i.length;h++){if(i[h]==eq){return true;}}i.push(eq);};function iw(event,eq){var i=bh[event];if(!i){return;}for(var h=0;h<i.length;h++){if(i[h]==eq){i.splice(h,1);}}};function aq(event,az){var i=bh[event];if(!i){return;}if(!az){az=fu();}for(var h=0;h<i.length;h++){i[h](az);}};function iv(){while(bh.length){var i=bh.pop();while(i.length){i.pop();}i=null;}bh=null;};function iu(e){e=_GetEvent(e);var my=ez;var x=dh;var y=dg;switch(e.keyCode){case 9:if(bi&&ci){bx();}return true;case 37:x=-my;break;case 38:y=-my;break;case 39:x=my;break;case 40:y=my;break;case 107:case 187:case 61:case 43:x=0;y=0;fr();break;case 109:case 189:case 45:x=0;y=0;es();break;default:return false;};if(x||y){dc(x,y,null,true);};if(ja){window.status="e.keyCode:"+e.keyCode;};return false;};function kj(e){e=_GetEvent(e);var x=dh;var y=dg;switch(e.keyCode){case 37:x=0;break;case 38:y=0;break;case 39:x=0;break;case 40:y=0;break;default:return false;};dc(x,y,null,true);return false;};function mg(container){var s=null;this.Init=function(){if(navigator.userAgent.toLowerCase().indexOf("msie")!=-1){s=document.createElement("div");s.className="logoSuperMap logoSuperMap_IE";}else{s=document.createElement("img");s.src="images/supermapisnet.png";s.className="logoSuperMap";};cf();container.appendChild(s);};this.Destroy=function(){container.removeChild(s);s=null;};function cf(){var ek=s.style.pixelHeight;if(!ek){ek=30;};s.style.top=(dt-ek-3)+"px";s.style.left="6px";s.style.display="block";};function hi(){cf();};this.er=cf;this.ie=hi;};function an(e){e.pixelCoord=new SuperMap.IS.PixelCoord(x11+aa+_GetMouseX(e)-kl,w+z+_GetMouseY(e)-kk);e.mapCoord=r.PixelToMapCoord(e.pixelCoord);e.offsetCoord=new SuperMap.IS.PixelCoord(e.pixelCoord.x-x11,e.pixelCoord.y-w);if(ja){window.status="e.pixelCoord:"+e.pixelCoord.x+","+e.pixelCoord.y;};};function gv(e){e=_GetEvent(e);_CancelBubble(e);an(e);if(d&&d.OnMouseDown){d.OnMouseDown(e);};return false;};function gu(e){e=_GetEvent(e);_CancelBubble(e);an(e);if(d&&d.OnMouseMove){d.OnMouseMove(e);};return false;};function it(e){e=_GetEvent(e);_CancelBubble(e);an(e);if(d&&d.OnMouseUp){d.OnMouseUp(e);};bo.focus();return false;};function ki(e){e=_GetEvent(e);_CancelBubble(e);an(e);if(d&&d.OnClick){d.OnClick(e);};};function hq(e){e=_GetEvent(e);_CancelBubble(e);an(e);cu();if(bi||ak){return false;};var ln=ae.MakeCopy();ln.SetPixelCenter(new SuperMap.IS.PixelCoord(x11+aa+_GetMouseX(e)-kl,w+z+_GetMouseY(e)-kk));if(e.altKey){ln.SetZoomLevel(a.zoomLevel-1);}else{ln.SetZoomLevel(a.zoomLevel+1);};t(ln);};function fk(e){e=_GetEvent(e);_CancelBubble(e);an(e);if(d&&d.OnContextMenu){d.OnContextMenu(e);};if(e.preventDefault){e.preventDefault();};return false;};function bv(e){e=_GetEvent(e);_CancelBubble(e);if(bi||ak){return false;};var ah=_GetMouseScrollDelta(e);if(ah>0){fr();}else if(ah<0){es();};if(e.preventDefault){e.preventDefault();};return false;};function hh(e){};function kr(ac,p){if(ac==0&&p==0){return;};du(a,el,ac,p);aa=a.pixelCenter.x-x11-dx/2;z=a.pixelCenter.y-w-dt/2;i1.style.top=-z+"px";i1.style.left=-aa+"px";window.setTimeout(kb,1);aq("onchangeview");};function dc(ac,p,bf,fl){if(ak){return;}if(!bf){bf=-1;}dh=ac;dg=p;da=bf;if(!ac&&!p){bx();return;};ci=fl;if(!bi){bi=true;ir();aq("onstartdynamicpan");};};function ir(){if(!bi){return;};kr(dh,dg);if(da>0)da--;if(da!=0){window.setTimeout(ir,10);}else{bx();};};function bx(){dh=0;dg=0;bi=false;ci=false;if(en!=null&&eo!=null){var io=new SuperMap.IS.MapCoord(en,eo);var ly=r.MapCoordToPixel(io,a.zoomLevel);var bs=ly.x-(x11+aa+dx/2);var br=ly.y-(w+z+dt/2);kr(bs,br);ae.Copy(a);en=null;eo=null;};fh(true);aq("onenddynamicpan");aq("onchangeview");};function eh(x,y){en=x;eo=y;ds(r.MapCoordToPixel(new SuperMap.IS.MapCoord(x,y),a.zoomLevel));};function gt(ln){ds(ln.pixelCenter);};function ds(ly){var bs=ly.x-(x11+aa+dx/2);var br=ly.y-(w+z+dt/2);var b=Math.sqrt(bs*bs+br*br);if(!ay||_Abs(bs)>2*dx||_Abs(br)>2*dt||b>2.5*Math.sqrt(dx*dx+dt*dt)){var ln=ae.MakeCopy();ln.SetPixelCenter(ly);t(ln);return;};var cy=Math.atan2(br,bs);var bf=_Ceil(b/gk);var al=_Round(b/bf);bs=_Round(Math.cos(cy)*al);br=_Round(Math.sin(cy)*al);dc(bs,br,bf);};function ce(x,y,dv){var bb=new lb();bb.Init(x,y,dv,(x*k-x11),(y*k-w));return bb;};function fy(mp){while(mp.length>0){mp.pop().Destroy();}};function lb(){var l=null;var c=null;var v=document.createElement("div");var gl=0;var gz=0;var ju=0;var zIndex=0;var jw=ab+1;var cs=new Array(jw);var cr=new Array(jw);var lh=new Array(jw);var gs=new Array(jw);var de=false;var cq=0,cp=0,hw=0,hv=0;var dk=0,dj=0,jt=0,js=0;var fp=null;var ea=this;this.Init=function(tileX,tileY,zoomLevel,x,y){gl=tileX;gz=tileY;ju=zoomLevel;v.style.font="7pt Verdana, sans-serif";v.style.color="Red";v.style.backgroundColor="White";if(!r.ey(gl,gz,ju)){return;};cj(x,y,k,k);fc(x,y,k,k);y11();var ed=gl+","+gz+","+ju;ea.id=ed;if(m[ed]){l=m[ed];l.onmousedown=function(e){return false;};if(!ak){au(aj);};}else{c=new Image(k,k);c.id=ed;c.onload=kq;c.onerror=kh;fp=new Date();c.src=r.gm(gl,gz,ju);};};this.Destroy=function(){if(l){l.onmousedown=null;}af();while(cs.length>0){cs.pop();}while(cr.length>0){cr.pop();}while(lh.length>0){lh.pop();}while(gs.length>0){gs.pop();}cs=cr=lh=gs=null;ea=null;};function cj(x,y,width,height){cq=x;cp=y;hw=width;hv=height;};function fc(x,y,width,height){dk=x;dj=y;jt=width;js=height;};function db(){for(var h=0;h<=ab;h++){cs[h]=cq;cr[h]=cp;lh[h]=hw;gs[h]=hv;}};function y11(){for(var h=0;h<=ab;h++){var cb=h/ab;var cg=1.0-cb;cs[h]=_Floor(cg*cq+cb*dk);cr[h]=_Floor(cg*cp+cb*dj);lh[h]=_Ceil(cg*hw+cb*jt);gs[h]=_Ceil(cg*hv+cb*js);};};function au(h){if(l==null||(ak&&!de)){return;};var is=l.style;is.left=cs[h]+"px";is.top=cr[h]+"px";is.width=lh[h]+"px";is.height=gs[h]+"px";var kd=v.style;if(ja&&h==0){is.border="1px dashed red";kd.left=cs[h]+"px";kd.top=cr[h]+"px";};if(l.parentNode!=i1){is.position="absolute";is.zIndex=zIndex;i1.appendChild(l);if(ja&&v.parentNode!=i1){v.innerHTML=l.id;kd.position="absolute";kd.zIndex=(zIndex+1);i1.appendChild(v);};};};function bj(){var cx=0;cx=cq;cq=dk;dk=cx;cx=cp;cp=dj;dj=cx;cx=hw;hw=jt;jt=cx;cx=hv;hv=js;js=cx;};function af(){if(!dz){return be();};if(ap.length>36){var am=ap.splice(0,18);while(am.length>0){var bd=am.pop();bd.dm();bd=null;};am=null;};if(!ak){while(ap.length>0){var mi=ap.pop();mi.dm();mi=null;};be();return;};if(!l){be();return;};l.style.zIndex=-1;var lm=gb;var ll=this.v;ap.push(ea);if(ja){window.status="preTiles:"+ap.length;};lm=null;ll=null;ea.unused=true;return;if(c){c.onload=null;c.onerror=null;delete c;c=null;}if(l){if(l.parentNode==i1){i1.removeChild(l);}delete l;l=null;}if(v){if(v.parentNode==i1){i1.removeChild(v);}v=null;};};function be(){for(var h=0;h<ap.length;h++){if(ap[h].id==this.id){ap.splice(h,1);break;};};if(c){c.onload=null;c.onerror=null;delete c;c=null;};if(l){if(l.parentNode==i1){i1.removeChild(l);}delete l;l=null;};if(v){if(v.parentNode==i1){i1.removeChild(v);}v=null;};};function kq(){if(ju!=a.zoomLevel||c==null){return;};if(m.length>dr){for(var h=0;h<dr/3;h++){delete m[m[0]];m.shift();};};m[c.id]=c;m.push(c.id);var et=new Date();var fz=et.getTime()-fp.getTime();if(ja){window.status="elapsedTime="+fz;};c.onload=null;c.onerror=null;l=c;l.onmousedown=function(e){return false;};delete c;c=null;if(!ak){au(aj);};};function kh(){if(ju!=a.zoomLevel||c==null){return;}var et=new Date();var fz=et.getTime()-fp.getTime();c.onload=null;c.onerror=null;c=null;};function ge(ig,ic,ip,ib,hu,ik){cj(cq-aa,cp-z,hw,hv);var lz=av[ik-1]/av[ip-1];dk=_Floor((ig+cq)*lz-ib);dj=_Floor((ic+cp)*lz-hu);jt=_Ceil((ig+cq+hw)*lz-ib)-dk;js=_Ceil((ic+cp+hv)*lz-hu)-dj;de=true;y11();zIndex=gi;if(l!=null){l.style.zIndex=zIndex;};};function gd(ig,ic,ip,ib,hu,ik){var lz=av[ik-1]/av[ip-1];dk=_Floor((ig+cq)*lz-ib);dj=_Floor((ic+cp)*lz-hu);jt=_Ceil((ig+cq+hw)*lz-ib)-dk;js=_Ceil((ic+cp+hv)*lz-hu)-dj;var fq=_Ceil(j*0.25);var fo=_Ceil(ad*0.25);de=(ik<ip)&&(gl<bl+fq||gl>cd-fq||gz<bk+fo||gz>cc-fo);de=false;bj();y11();zIndex=gj;};function iy(ec){if(l!=null){l.style.border=ec?"1px dashed blue":"0px";}v.style.display=ec?"block":"none";};this.kx=cj;this.lk=fc;this.aw=db;this.md=y11;this.cm=au;this.ep=bj;this.ao=af;this.dm=be;this.mc=ge;this.mb=gd;this.Debug=iy;};function hp(){fy(o);i1.style.top="0px";i1.style.left="0px";x11=_Round(a.pixelCenter.x-dx/2);w=_Round(a.pixelCenter.y-dt/2);aa=0;z=0;bl=_Floor((x11-bu)/k);bk=_Floor((w-bu)/k);cd=_Floor((x11+dx+bu)/k);cc=_Floor((w+dt+bu)/k);j=cd-bl+1;ad=cc-bk+1;for(var y=bk;y<=cc;y++){for(var x=bl;x<=cd;x++){var bb=ce(x,y,a.zoomLevel);o.push(bb);};};if(ja){window.status="_tileCountX,Y:"+j+","+ad;};};function kb(){if(ak){return;};var li=x11+aa;var lg=w+z;var kl=_Floor((li-bu)/k);var kk=_Floor((lg-bu)/k);var dk=_Floor((li+dx+bu)/k);var dj=_Floor((lg+dt+bu)/k);while(bl<kl){for(var y=ad-1;y>=0;y--){var bb=o.splice(y*j,1)[0];bb.ao();};bl++;j--;};while(bl>kl){bl--;j++;for(var y=0;y<ad;y++){var bb=ce(bl,bk+y,a.zoomLevel);o.splice(y*j,0,bb);};};while(bk<kk){for(var x=0;x<j;x++){var bb=o.shift();bb.ao();}bk++;ad--;};while(bk>kk){bk--;ad++;for(var x=j-1;x>=0;x--){var bb=ce(bl+x,bk,a.zoomLevel);o.unshift(bb);}};while(cd>dk){for(var y=ad-1;y>=0;y--){var bb=o.splice(y*j+j-1,1)[0];bb.ao();}cd--;j--;};while(cd<dk){cd++;j++;for(var y=0;y<ad;y++){var bb=ce(cd,bk+y,a.zoomLevel);o.splice(y*j+j-1,0,bb);}};while(cc>dj){for(var x=0;x<j;x++){var bb=o.pop();bb.ao();}cc--;ad--;};while(cc<dj){cc++;ad++;for(var x=0;x<j;x++){var bb=ce(bl+x,cc,a.zoomLevel);o.push(bb);}};};function t(ln){if(ak||bi||ke){return;};var center=ln.mapCenter;if(ln.GetViewType()=="mr"){center=ln.mapRect.Center();};r=gb;container.style.backgroundColor="#eeeeee";ln.Resolve(r,dx,dt);center=ln.mapCenter;ae.Copy(ln);r.fs(ln);el=r.go(ln);ff(ln,el);ln.Resolve(r,dx,dt);if(ln.Equals(a)){return;};var ac=ln.GetPixelX(a.zoomLevel)-a.pixelCenter.x;var p=ln.GetPixelY(a.zoomLevel)-a.pixelCenter.y;var b=Math.sqrt(ac*ac+p*p);var mm=(b<dx&&b<dt)&&(ln.zoomLevel==a.zoomLevel)&&ay;if(mm){eh(center.x,center.y);return;};fd=a.zoomLevel;if(a.zoomLevel!=ln.zoomLevel){aq("onstartzoom");ak=true;};var ct=(b<dx&&b<dt)&&(_Abs(ln.zoomLevel-a.zoomLevel)<3)&&ay;if(ct){var ig=x11+aa;var ic=w+z;var ip=a.zoomLevel;var ib=_Round(ln.pixelCenter.x-dx/2);var hu=_Round(ln.pixelCenter.y-dt/2);var ik=ln.zoomLevel;bn=o;o=new Array();for(var h=0;h<bn.length;h++){bn[h].mc(ig,ic,ip,ib,hu,ik);};for(var h=0;h<ai.length;h++){ai[h].me(ib,hu,ik);};ef();a.Destroy();a=ln;hp();for(var h=0;h<o.length;h++){o[h].mb(ig,ic,ip,ib,hu,ik);};aj=1;au();return;};bn=o;o=new Array();a.Destroy();a=ln;ef();hp();bj();gc();};function au(){if(!ak){return;};for(var h=0;h<bn.length;h++){bn[h].cm(aj);};for(var h=0;h<o.length;h++){o[h].cm(aj);};for(var h=0;h<ai.length;h++){ai[h].cm(aj);};if(aj<ab){aj++;window.setTimeout(au,1);}else{aj=0;bj();};};function bj(){fy(bn);bn=null;ak=false;for(var h=0;h<o.length;h++){o[h].ep();o[h].aw();o[h].cm(0);};for(var h=0;h<ai.length;h++){ai[h].ep();ai[h].aw();ai[h].cm(0);};window.setTimeout(hc,250);if(fd!=a.zoomLevel){aq("onendzoom");};aq("onchangeview");try{CollectGarbage();}catch(ex){};};function fb(nd,nc,nb,na){var ln=ae.MakeCopy();ln.SetMapRect(new SuperMap.IS.MapRect(nd,nc,nb,na));t(ln);};function hz(jb){if(!jb||jb.constructor!=Array){return;};var cb=jb[0].x;var cg=jb[0].y;var dl=cb;var df=cg;for(var h=1;h<jb.length;h++){cb=_Min(cb,jb[h].x);cg=_Min(cg,jb[h].y);dl=_Max(dl,jb[h].x);df=_Max(df,jb[h].y);};var bs=(dl-cb)*0.1;var br=(df-cg)*0.1;cb-=bs;cg-=br;dl+=bs;df+=br;fb(ho(cb),hn(cg),ho(dl),hn(df));};function iq(x,y){var io=new SuperMap.IS.MapCoord(x,y);var mw=ee();var jv=mw.Width();var jp=mw.Height();mw.leftBottom.x+=jv*0.1;mw.leftBottom.y+=jp*0.1;mw.rightTop.x-=jv*0.1;mw.rightTop.y-=jp*0.1;if(mw.Contains(io)){return;};var ln=ae.MakeCopy();ln.SetMapCenter(new SuperMap.IS.MapCoord(x,y));t(ln);};function hy(dv){var ln=ae.MakeCopy();ln.SetZoomLevel(dv);t(ln);};function fr(){var ln=ae.MakeCopy();ln.SetZoomLevel(a.zoomLevel+1);t(ln);};function es(){var ln=ae.MakeCopy();ln.SetZoomLevel(a.zoomLevel-1);t(ln);};function ft(x,y,dv){var ln=ae.MakeCopy();ln.SetMapCenter(new SuperMap.IS.MapCoord(x,y));ln.SetZoomLevel(dv);t(ln);};function ho(x){return ky(x,mapBounds.leftBottom.x,mapBounds.rightTop.x);};function hn(y){return ky(y,mapBounds.leftBottom.y,mapBounds.rightTop.y);};function ky(jw,jr,jq){if(jw<jr){return jr;}if(jw>jq){return jq;}return jw;};function mo(){var ht=1;var hs=av.length;this.Init=function(){var bq=null;var kz=_GetXmlHttpRequest();kz.open("get",cz+"common.ashx?map="+encodeURI(ch)+"&method=GetMapStatus&t="+new Date().getTime(),false);kz.send(null);if(kz.status==200){var jm=eval('('+kz.responseText+')');if(jm){bq=new SuperMap.IS.MapStatus();bq.FromJSON(jm);ch=bq.mapName;referViewBounds=bq.referViewBounds;referScale=bq.referScale;referViewer=bq.referViewer;mapBounds=bq.mapBounds;ha=true;};};};this.Destroy=function(){};function im(gl,gz,dv){return true;};function jl(gl,gz,dv){return cz+"ajax/"+encodeURI(ch)+"/"+(av[dv-1])+"/"+gl+"/"+gz+"/"+k+"/"+fi+"/map.ashx";};function as(ms,dv){if(!dv){dv=a.zoomLevel}return(referScale/av[dv-1])*referViewBounds.Width()/referViewer.Width()*ms;};function ck(ly,dv){var b=as(1,dv);var io=new SuperMap.IS.MapCoord();io.x=mapBounds.leftBottom.x+(ly.x*b);io.y=mapBounds.rightTop.y-(ly.y*b);return io;};function ba(io,dv){var b=as(1,dv);var ly=new SuperMap.IS.PixelCoord();ly.x=parseInt((io.x-mapBounds.leftBottom.x)/b);ly.y=parseInt((mapBounds.rightTop.y-io.y)/b);return ly;};function ka(ln){return mapBounds;};function fj(ln){if(ln.zoomLevel>hs){ln.SetZoomLevel(hs);}if(ln.zoomLevel<ht){ln.SetZoomLevel(ht);}};this.ey=im;this.gm=jl;this.PixelToMapDistance=as;this.PixelToMapCoord=ck;this.MapCoordToPixel=ba;this.go=ka;this.fs=fj;};function il(){return a.MakeCopy();};function jk(){return x11;};function jj(){return w;};function ji(){return aa;};function jh(){return z;};function hg(){return x;};function hf(){return y;};function jz(ca){if(d&&(d!=bc&&d!=bp)){d.Destroy();};if(ca){ca.Init(gw);};d=ca;};function jy(){return d;};function ij(id,x,y,ml,hl,innerHtml,className,zIndex){var jo=new mf();jo.Init(id,x,y,ml,hl,innerHtml,className,zIndex);ai.push(jo);return jo.div;};function jg(id,x,y,ml,hl,innerHtml,className,zIndex){for(var h=0;h<ai.length;h++){var jo=ai[h];if(jo.id==id){jo.Init(id,x,y,ml,hl,innerHtml,className,zIndex);return jo.div;};};return ij(id,x,y,ml,hl,innerHtml,className,zIndex);};function jf(id){for(var h=0;h<ai.length;h++){var jo=ai[h];if(jo.id==id){ai.splice(h,1);jo.Destroy();jo=null;return;}}};function fx(){while(ai.length>0)ai.pop().Destroy();};function gc(){for(var h=0;h<ai.length;h++){ai[h].er();}};function mf(){var div=document.createElement("div");div.jo=this;this.div=div;var cq=0,cp=0,dk=0,dj=0;var io=null;var width=0;var height=0;var jw=ab+1;var cs=new Array(jw);var cr=new Array(jw);this.Init=function(id,x,y,ml,hl,innerHtml,className,zIndex){this.id=id;div.id=id;div.className=className;div.style.position="absolute";div.innerHTML=innerHtml;if(!zIndex){div.style.zIndex=dy;}else{div.style.zIndex=zIndex;};if(!params.fixedView){div.attachEvent("onmousedown",hh);div.attachEvent("ondblclick",dn);div.attachEvent("onmousewheel",bv);};io=new SuperMap.IS.MapCoord(x,y);width=ml;height=hl;var ly=r.MapCoordToPixel(io,a.zoomLevel);if(ly){cq=_Round(ly.x-x11);cp=_Round(ly.y-w);dk=cq;dj=cp;y11();au(0);div.style.display="block";}else{div.style.display="none";};i1.appendChild(div);};this.Destroy=function(){div.detachEvent("ondblclick",dn);div.detachEvent("onmousewheel",bv);af();div.jo=null;div=null;this.div=null;while(cs.length>0){cs.pop();}while(cr.length>0){cr.pop();}};this.GetMapCoordX=function(){return io.x;};this.GetMapCoordY=function(){return io.y;};function db(){var jw=ab;for(var h=0;h<=jw;h++){cs[h]=cq-width/2;cr[h]=cp-height/2;}};function y11(){var jw=ab;for(var h=0;h<=jw;h++){var cb=h/jw;var cg=1.0-cb;cs[h]=_Floor(cg*cq+cb*dk-width/2);cr[h]=_Floor(cg*cp+cb*dj-height/2);}};function au(h){div.style.left=cs[h]+"px";div.style.top=cr[h]+"px";};function bj(){var cx=0;cx=cq;cq=dk;dk=cx;cx=cp;cp=dj;dj=cx;};function cf(){var ly=r.MapCoordToPixel(io,a.zoomLevel);if(ly){cq=_Round(ly.x-x11);cp=_Round(ly.y-w);db();au(0);div.style.display="block";}else{div.style.display="none";}};function gr(ib,hu,ik){cq-=aa;cp-=z;var ly=r.MapCoordToPixel(io,ik);if(ly){dk=_Round(ly.x-ib);dj=_Round(ly.y-hu);y11();div.style.display="block";}else{div.style.display="none";}};function af(){if(div.parentNode==i1){i1.removeChild(div);}};function dn(e){e=_GetEvent(e);_CancelBubble(e);if(bi||ak){return false;}var ln=ae.MakeCopy();ln.SetMapCenter(io);if(e.altKey){ln.SetZoomLevel(a.zoomLevel-1);}else{ln.SetZoomLevel(a.zoomLevel+1);}t(ln);return false;};function bv(e){e=_GetEvent(e);_CancelBubble(e);if(bi||ak){return false;}var ah=_GetMouseScrollDelta(e);if(ah>0){fr();}else if(ah<0){es();}return false;};this.aw=db;this.md=y11;this.cm=au;this.ep=bj;this.er=cf;this.me=gr;this.ao=af;};function ii(id,cs,cr,n,u,zIndex){if(id==null||cs==null||cr==null){return null;};var ei=new ih();ei.Init(id,cs,cr,n,u,null,null,zIndex);ax.push(ei);return ei;};function je(id,cs,cr,n,u,zIndex){if(id==null||cs==null||cr==null){return null;};for(var h=0;h<ax.length;h++){var ei=ax[h];if(ei.id==id){ei.Init(id,cs,cr,n,u,null,null,zIndex);};return ei;};return ii(id,cs,cr,n,u,zIndex);};function jd(id){for(var h=0;h<ax.length;h++){var ei=ax[h];if(ei.id==id){ax.splice(h,1);ei.Destroy();return;}};};function fw(){while(ax.length>0)ax.pop().Destroy();};function fv(id,cs,cr,n,u,dq,dp,zIndex){if(id==null||cs==null||cr==null){return null;};var lo=new ih(true);lo.Init(id,cs,cr,n,u,dq,dp,zIndex);q.push(lo);return lo;};function he(id,cs,cr,n,u,dq,dp,zIndex){if(id==null||cs==null||cr==null){return null;};var lo=null;for(var h=0;h<q.length;h++){lo=q[h];if(lo.id==id){lo.Init(id,cs,cr,n,u,dq,dp,zIndex);return lo;};};lo=null;return fv(id,cs,cr,n,u,dq,dp,zIndex);};function hd(id){for(var h=0;q&&h<q.length;h++){var lo=q[h];if(lo.id==id){q.splice(h,1);lo.Destroy();return;}};};function eg(){while(q.length>0)q.pop().Destroy();};function ih(bw){if(!bw){bw=false;};var dd=bw;var ej="3pt";var ex="#316AC5";var fn="#316AC5";var ew="0.6";var gx=4;var di=true;var f=null;var g=null;var co=null;var fm=null;var bz=null;var ev="";var cv="";var bt="";var eb="";var fe="";var gh=0;var ku=0;var kt=0;var lq=0;var lp=0;var by=null;var cl=null;function lw(id,cs,cr,n,u,dq,dp,zIndex){if(!n){n=ej;};if(!u){u=ex;};if(!dq){dq=fn;};if(!dp){dp=ew;};if(!zIndex){zIndex=gx;};this.id=id;ev=id;cv=n;bt=u;eb=dq;fe=dp;gh=zIndex;by=cs.concat();cl=cr.concat();ku=by[0];kt=cl[0];lq=by[by.length-1];lp=cl[cl.length-1];kg();};function kp(){af();if(co){co.clear();}by=cl=f=co=g=fm=bz=null;};function af(){if(f&&f.parentNode!=null){f.parentNode.removeChild(f);};if(g&&g.parentNode!=null){g.parentNode.removeChild(g);};};function lv(){if(!di){jx();return;}if(f){f.style.display="block";}if(g){g.style.display="block";}};function jx(){if(f){f.style.display="none";}if(g){g.style.display="none";}};function jc(cw){di=cw;if(!di){jx();}};function kg(){fa();};function hi(){fa();};function fa(){var mh=new Array();gq(mh);gp(mh);mh=null;};function gq(mh){var io=new SuperMap.IS.MapCoord();for(var h=0;h<by.length;h++){io.x=by[h];io.y=cl[h];var ly=ba(io);mh.push((ly.x+aa));mh.push((ly.y+z));};if(dd){io.x=by[0];io.y=cl[0];var ly=ba(io);mh.push((ly.x+aa));mh.push((ly.y+z));};io=null;};function gp(mh){if(ygPos.browser!="ie"){if(!g){g=document.createElement("div");g.id=ev;g.style.position="absolute";g.style.left="0px";g.style.top="0px";g.unselectable="on";i1.appendChild(g);co=new jsGraphics(ev);co.setColor(bt);co.setStroke(cv);}else{co.clear();};g.style.zIndex=gh;if(di){g.style.display="block";g.style.visibility="visible";}else{g.style.display="none";g.style.visibility="";};var mr=_SplitX(mh);var mn=_SplitY(mh);if(dd){co.setColor(eb);co.fillPolygon(mr,mn);co.setColor(bt);co.drawPolygon(mr,mn);}else{co.setColor(bt);co.drawPolyline(mr,mn);};co.paint();return false;};var at=false;if(f){at=true;};var ma=mh.join(",");if(!at){f=document.createElement("v:polyline");f.setAttribute("points",ma);}else{f.points.value=ma;};f.id=ev;if(dd){f.filled="true";}else{f.filled="false";};f.style.zIndex=gh;f.unselectable="on";f.style.position="absolute";f.style.border="0px";if(di){f.style.display="block";}else{f.style.display="none";};if(dd){if(!at){fm=document.createElement("v:fill");f.appendChild(fm);};fm.setAttribute("opacity",fe);fm.setAttribute("color",eb);};if(!at){bz=document.createElement("v:stroke");f.appendChild(bz);};bz.setAttribute("weight",cv);bz.setAttribute("color",bt);bz.setAttribute("joinstyle","round");bz.setAttribute("endcap","round");bz.setAttribute("opacity","0.75");if(!at){i1.appendChild(f);};};this.Init=lw;this.Destroy=kp;this.ao=af;this.lj=lv;this.gy=jx;this.lu=jc;this.kw=kg;this.ie=hi;};function hc(){for(var h=0;h<ax.length;h++){ax[h].kw();ax[h].lj();};for(var h=0;h<q.length;h++){q[h].kw();q[h].lj();};};function ef(){for(var h=0;h<ax.length;h++){ax[h].gy();};for(var h=0;h<q.length;h++){q[h].gy();};};function ko(){for(var h=0;h<ax.length;h++){ax[h].ie();};for(var h=0;h<q.length;h++){q[h].ie();};};function hx(){var lf=new SuperMap.IS.MapRect();lf.Copy(mapBounds);return lf;};function ee(){var mu=new SuperMap.IS.PixelRect();var hb=mu.leftTop;var mt=mu.rightBottom;hb.x=a.pixelCenter.x-dx/2;hb.y=a.pixelCenter.y-dt/2;mt.x=hb.x+dx;mt.y=hb.y+dt;var ld=new SuperMap.IS.MapRect();var hm=ld.leftBottom;var mq=ld.rightTop;var kv=r.PixelToMapCoord(hb);var kn=r.PixelToMapCoord(mt);hm.x=kv.x;hm.y=kn.y;mq.x=kn.x;mq.y=kv.y;return ld;};this.GetMapCenterX=hk;this.GetMapCenterY=hj;this.GetPixelCenterX=gg;this.GetPixelCenterY=gf;this.MapCoordToPixel=ba;this.PixelToMapCoord=ck;this.GetZoomLevel=ia;this.GetMapBounds=hx;this.GetViewBounds=ee;this.PixelToMapDistance=as;this.GetSize=ks;this.Resize=lc;this.Pan=kr;this.DynamicPan=dc;this.StopDynamicPan=bx;this.PanToMapCoord=eh;this.ViewByBounds=fb;this.ViewByPoints=hz;this.ViewByPoint=iq;this.SetZoomLevel=hy;this.ZoomIn=fr;this.ZoomOut=es;this.SetCenterAndZoom=ft;this.AttachEvent=ix;this.DetachEvent=iw;this.SetAnimationEnabled=eu;this.IsAnimationEnabled=fg;this.SetMapParam=t;this.GetMapParam=il;this.Debug=iy;this.GetOriginX=jk;this.GetOriginY=jj;this.GetOffsetX=ji;this.GetOffsetY=jh;this.GetContainerX=hg;this.GetContainerY=hf;this.GetAction=jy;this.SetAction=jz;this.CustomLayer=function(){};var bg=this.CustomLayer;bg.AddMark=ij;bg.InsertMark=jg;bg.RemoveMark=jf;bg.ClearMarks=fx;bg.AddLine=ii;bg.InsertLine=je;bg.RemoveLine=jd;bg.ClearLines=fw;bg.AddPolygon=fv;bg.InsertPolygon=he;bg.RemovePolygon=hd;bg.ClearPolygons=eg;bg=null;var mj=null;this.GetQueryManager=function(){if(!mj){mj=new SuperMap.IS.QueryManager(cz,ch);}return mj;};};
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -