You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1 line
6.7 KiB

/**/_jsload2 && _jsload2('pservice', 'var Bj=5;bd.ev=B.Sf("pano")[0];bd.pl=bd.ev+"?";bd.LG=B.Sf("baidumap");bd.kQ=B.Sf("main_domain_nocdn");bd.Xd=new T;bd.FB=[]; x.extend(bd.prototype,{lR:function(){var a=this,b;for(b in this.yd)if(0!==this.yd[b].length)switch(b){case "getPanoramaById":x.Fb(this.yd[b],function(b){a.xp.apply(a,b)});break;case "getPanoramaByLocation":x.Fb(this.yd[b],function(b){a.tj.apply(a,b)});break;case "getVisiblePOIs":x.Fb(this.yd[b],function(b){a.FE.apply(a,b)});break;case "getRecommendPanosById":x.Fb(this.yd[b],function(b){a.ay.apply(a,b)});break;case "getPanoramaVersions":x.Fb(this.yd[b],function(b){a.$x.apply(a,b)});break;case "checkPanoSupportByCityCode":x.Fb(this.yd[b], function(b){a.IC.apply(a,b)});break;case "getPanoramaByPOIId":x.Fb(this.yd[b],function(b){a.Zx.apply(a,b)});break;case "getCopyrightProviders":x.Fb(this.yd[b],function(b){a.z3.apply(a,b)})}},xp:function(a,b,c){this.hI(bd.pl+"qt=sdata&l=17&sid="+a+"&fn=",b,c)},tj:function(a,b,c){"function"==typeof b&&(c=b,b=50);a=bd.Xd.Fl(a);this.hI(bd.pl+"qt=qsdata&x="+a.x+"&y="+a.y+"&r="+b+"&action=1&fn=",c)},FE:function(a,b,c,d){a=bd.Xd.Fl(a);this.mg(bd.pl+"qt=search&x="+a.x+"&y="+a.y+"&radius="+b+"&tag="+c+"&fn=", function(a){for(var a=a.content,b=[],c=p,i=a.length-1;0<=i;i--)c=a[i],b.push({iconType:c.Type,title:c.name,altitude:c.Height,panoInfo:{panoId:c.PID,panoIId:c.IID,heading:c.Dir,pitch:c.Pitch},position:bd.Xd.Ej(new R(c.X,c.Y))});d(b)},o)},ay:function(a,b){this.mg(bd.pl+"qt=guide&sid="+a+"&fn=",function(a){if(a.content){for(var a=a.content,d=[],e=p,f=0,g=a.length;f<g;f++)e=a[f],d.push({panoId:e.PID,heading:e.Dir,name:e.Info,recoType:e.Type,pitch:e.Pitch,catlog:e.Catalog,floor:e.Floor});b(d)}},o)},WL:function(a){this.mg(bd.LG+ "?qt=panoCMS&file=pano_copyright&callback=",function(b){a(b)})},$x:function(a){this.mg(bd.LG+"?qt=pver&callback=",function(b){b?a&&a(b):a&&a(p)})},IC:function(a,b){function c(a){for(var b=bd.FB,c=0,g=b.length;c<g;c++)if(b[c]==a)return o;return q}0===bd.FB.length?this.mg(bd.kQ+"?qt=panoCityList&t="+(new Date).getTime()+"&callback=",function(d){d?(bd.FB=d,b(c(a))):b(q)}):b(c(a))},Zx:function(a,b){var c=this;this.$x(function(d){d&&d.panoUdt&&c.mg(bd.pl+"qt=poi&udt="+d.panoUdt.version+"&uid="+a+"&fn=", function(a){if(a&&a.content&&a.content[0]&&a.content[0].poiinfo){var a=a.content[0].poiinfo,d={id:a.IID||a.PID,pid:a.PID,type:1==a.hasinter?"inter":"street",description:a.name,links:p,position:bd.Xd.Ej(new R(a.X,a.Y)),tiles:p,pov:1==a.hasinter?p:{heading:a.Dir,pitch:a.Pitch}};"inter"===d.type?c.VS(a.IID,function(a){if(a){for(var c=a.Defaultfloor,e=p,l=0,m=a.Floors.length;l<m;l++)if(a.Floors[l].Floor===c){e=a.Floors[l];break}e&&(d.interID=e.StartID)}b(d)}):b(d)}else b(p)},o)})},Y1:function(a,b,c){var d= this;this.mg(a,function(a){a&&a.result&&0==a.result.error?b&&b(d.SI(a,c)):b&&b(p)})},hI:function(a,b,c){var d=this;this.mg(a,function(a){a&&a.result&&0==a.result.error?b&&b(d.SI(a,c)):b&&b(p)},o,o)},mg:function(a,b,c,d){var e=(1E5*Math.random()).toFixed(0);B._rd=B._rd||{};B._rd["_cbk"+e]=function(a){b&&b(a);delete B._rd["_cbk"+e]};a+="BMap._rd._cbk"+e;if(c&&(c=Fc(a)))d=Qc(c.path,{Kp:!d?q:o}),a+="&"+d;sa(a)},SI:function(a,b){var c={},d=a.content[0];c.description=d.Rname||d.Info||"";c.id=d.ID;c.wh= d.X/100;c.xh=d.Y/100;c.position=bd.Xd.Ej(new R(c.wh,c.xh));var e=this.KT(d,c.id,c.wh,c.xh,d.NorthDir);c.links=e[0];c.roads=e[1];c.links.sort(function(a,b){return a.zh-b.zh});c.mode=d.Mode;c.relevants=[];if(d.SwitchID)for(e=0;e<d.SwitchID.length;e++)c.relevants[e]={id:d.SwitchID[e].ID,mode:d.SwitchID[e].Time.toLowerCase()};c.tiles=new Cj({dirNorth:d.NorthDir,centerHeading:(180+d.NorthDir)%360,pitch:d.Pitch});if(d.Enters&&0<d.Enters.length){c.indoorPois=[];for(var e=0,f=d.Enters.length;e<f;e++)c.indoorPois.push({panoIId:d.Enters[e].IID, panoId:d.Enters[e].BreakID,title:d.Enters[e].Name,pointX:d.Enters[e].X/100,pointY:d.Enters[e].Y/100})}var f=[],g=d.VPoint;if(g)for(var i=g.length,e=0;e<i;e++){var j={};j.PID=g[e].PID;var l=bd.Xd.Ej(new R(g[e].X/100,g[e].Y/100));j.X=6378137*-(l.lat-c.position.lat)/180*Math.PI;j.Z=6378137*(l.lng-c.position.lng)/180*Math.PI;f.push(j)}c.VPoint=f;d.Inters&&0<d.Inters.length&&(c.pm=d.Inters[0].BreakID,c.bW=d.Inters[0].IID,c.heading=d.MoveDir,c.pitch=d.Pitch);b&&(c.pm=b.pm);c.copyright={};c.copyright.admission= d.Admission;c.copyright.dataProviderIndex=d.Provider;c.copyright.photoDate=d.Date;c.copyright.roadName=d.Rname;c.copyright.username=d.Username||"";return c},KT:function(a,b,c,d,e){var f=[],g={};if(a.Links)for(var i=0;i<a.Links.length;i++)f.push({id:a.Links[i].PID,dir:a.Links[i].DIR,x:a.Links[i].X/100,y:a.Links[i].Y/100,heading:a.Links[i].DIR,zh:this.QA(a.Links[i].DIR,e)});if(!a.Roads)return[f,g];for(i=0;i<a.Roads.length;i++)if(a.Roads[i].Panos)for(var j=0;j<a.Roads[i].Panos.length;j++){if(a.Roads[i].Panos[j].PID== b){var l=a.Roads[i].Name;""==l&&(l=a.Rname||"\\u672a\\u77e5");for(var m=p,n=p,s,u,w=j-1;0<=w;w--){a.Roads[i].Panos[w]&&m===p&&(m=a.Roads[i].Panos[w],s=(m.DIR+180)%360,g[s]=[]);var y=a.Roads[i].Panos[w];g[s]&&g[s].push({id:y.PID,x:y.X/100,y:y.Y/100,distanceToCurrent:this.oo(y.X/100,y.Y/100,c,d)})}m&&f.push({id:m.PID,dir:s,heading:s,description:l,x:m.X/100,y:m.Y/100,zh:this.QA(s,e)});for(w=j+1;w<a.Roads[i].Panos.length;w++)a.Roads[i].Panos[w]&&n===p&&(n=a.Roads[i].Panos[w],u=n.DIR,0==u&&(u=a.Roads[i].Panos[j].DIR), g[u]=[]),y=a.Roads[i].Panos[w],g[u]&&g[u].push({id:y.PID,x:y.X/100,y:y.Y/100,distanceToCurrent:this.oo(y.X/100,y.Y/100,c,d)});n!=p&&f.push({id:n.PID,dir:u,heading:u,description:l,x:n.X/100,y:n.Y/100,zh:this.QA(u,e)})}for(w=0;w<f.length;w++)a.Roads[i].Panos[j].PID==f[w].id&&(f[w].description=a.Roads[i].Name,""==f[w].description&&(f[w].description=a.Rname||"\\u672a\\u77e5"))}for(i=0;i<f.length;i++){var a=f[i].dir,b=q,D;for(D in g)if(D==a){b=o;break}if(b)break;g[a]=[{id:f[i].id,x:f[i].x,y:f[i].y,distanceToCurrent:this.oo(f[i].x, f[i].y,c,d)}]}return[f,g]},QA:function(a,b){var c=a+b;360<c&&(c%=360);return c=Math.round(100*c)/100},oo:function(a,b,c,d){return Math.round(Math.sqrt(Math.pow(a-c,2)+Math.pow(b-d,2)))},VS:function(a,b){this.mg(bd.pl+"qt=idata&l=17&iid="+a+"&fn=",function(a){a&&a.result&&0===a.result.error?b(a.content[0].interinfo):b(p)},o)}});bf=bd.prototype;U(bf,{getPanoramaById:bf.xp,getPanoramaByLocation:bf.tj,getPanoramaByPOIId:bf.Zx});function Cj(a){this.tileSize=new M(512,512);this.worldSize=new M(512*this.Bp(Bj),512*this.dy(Bj));this.centerHeading=180;var a=a||{},b;for(b in a)this[b]=a[b]}var Dj=B.Sf("pano",""); x.extend(Cj.prototype,{getTilesUrl:function(a,b,c){a=Dj[(b.x+b.y)%Dj.length]+"?qt=pdata&sid={sid}&pos={y}_{x}&z={zoom}".replace("{sid}",a).replace("{x}",b.x).replace("{y}",b.y).replace("{zoom}",c);a+="&from=JSAPI";return(b=Fc(a))?(b=Qc(b.path),a+("&"+b)):p},dy:function(a){return Math.pow(2,a-2)},Bp:function(a){return 2*this.dy(a)}}); ');