T.LocalSearch=function(t,i){this.map=t?t:null,this.config=i&&"undefined"!=typeof i?i:{},this.count="undefined"!=typeof this.config.pageCapacity?this.config.pageCapacity:10,this.keyWord=null,this.mapBound=null,this.level=null,this.bounds=null,this.specifyAdminCode=null,this.queryRadius=null,this.pointLonlat=null,this.start=0,this.countNumber=0,this.onSearchComplete=null,this.queryType=1,this.config&&(this.onSearchComplete=this.config.onSearchComplete?this.config.onSearchComplete:null,this.queryType=this.config.queryType?this.config.queryType:1),this.map&&(this.bounds=this._s(),this.mapBound=this._s(),this.level=this.map.getZoom()),this.type=null,this.result=null,this.lsResult=null,this.searchServerUrl=T.w.E},T.LocalSearch.prototype={_s:function(t){var i=this.map.getBounds();t&&(i=t);var e=i.getSouthWest(),s=i.getNorthEast(),n=e.getLng()+","+e.getLat()+","+s.getLng()+","+s.getLat();return n},setSpecifyAdminCode:function(t){this.specifyAdminCode=t},getSpecifyAdminCode:function(){return this.specifyAdminCode},clearSpecifyAdminCode:function(){this.specifyAdminCode=null},setQueryType:function(t){this.queryType=t},getQueryType:function(){return this.queryType},search:function(t,i){(this.keyWord!=t&&"undefined"!=typeof t||this.queryType!=i)&&(this.start=0),this.keyWord=t?t:this.keyWord,this.queryType=i?i:this.queryType;var e="{";this.keyWord&&(e+='"keyWord":"'+this.keyWord+'",'),e+='"level":"'+this.map.getZoom()+'",',e+='"mapBound":"'+this._s()+'",',e+='"queryType":"'+this.queryType+'",',e+='"start":"'+this.start+'",',this.specifyAdminCode&&(e+='"specify":"'+this.specifyAdminCode+'",'),e+='"count":"'+this.count+'"}',this.ms(e)},searchInBounds:function(t,i){(this.keyWord!=t&&"undefined"!=typeof t||2!=this.queryType)&&(this.start=0),this.bounds=i?i:this.bounds,this.keyWord=t?t:this.keyWord,this.queryType=2;var e="{";this.keyWord&&(e+='"keyWord":"'+this.keyWord+'",'),e+='"level":"'+this.map.getZoom()+'",',e+='"mapBound":"'+this._s(this.bounds)+'",',e+='"queryType":2,',e+='"start":"'+this.start+'",',e+='"count":"'+this.count+'"}',this.ms(e)},searchNearby:function(t,i,e){(this.keyWord!=t&&"undefined"!=typeof t||3!=this.queryType)&&(this.start=0),this.keyWord=t?t:this.keyWord,this.queryType=3,this.centerLngLat=i?i:null,this.radius=e?e:null;var s="{";this.keyWord&&(s+='"keyWord":"'+this.keyWord+'",'),s+='"level":"'+this.map.getZoom()+'",',s+='"mapBound":"'+this._s()+'",',s+='"pointLonlat":"'+this.centerLngLat.getLng()+","+this.centerLngLat.getLat()+'",',s+='"queryRadius":"'+e+'",',s+='"queryType":3,',s+='"start":"'+this.start+'",',s+='"count":"'+this.count+'"}',this.ms(s)},ms:function(t){var i=T.ScriptLoader.getObject(),e=""!=T.tk?"&tk="+window.TMAP_AUTHKEY:"";i.load(T.w.R+encodeURIComponent(encodeURIComponent(this.searchServerUrl+"/v2/search?postStr="+t+"&type=query"+e)),"UTF-8",this,this.QD)},QD:function(t){this.result=t,this.lsResult=new T.LocalSearchResult(t,this),this.onSearchComplete&&this.onSearchComplete(this.lsResult)},getResults:function(){return this.lsResult},clearResults:function(){this.lsResult=null},gotoPage:function(t,i){this.qD(t,i)},setPageCapacity:function(t){this.count=numl},getPageCapacity:function(){return this.count},setSearchCompleteCallback:function(t){this.onSearchComplete=t},qD:function(t,i){if(this.countPage*this.count<=0||t<0||t>this.countPage*this.count)return!1;if("localsearch"==i)this.countPage*this.count==t&&(t-=this.count),this.start=t;else{if(t>this.countPage||t<=0)return;this.start=(t-1)*this.count}3==this.queryType?this.searchNearby(this.keyWord,this.centerLngLat,this.radius):2==this.queryType?this.searchInBounds(this.keyWord,this.bounds):this.search(this.keyWord,this.queryType)},firstPage:function(){return this.qD(0,"localsearch")},nextPage:function(){return this.qD(this.start+this.count,"localsearch")},previousPage:function(){return this.qD(this.start-this.count,"localsearch")},lastPage:function(){return this.qD(Math.floor(this.countNumber/this.count)*this.count,"localsearch")},getCountNumber:function(){return this.countNumber},getCountPage:function(){return this.countPage},getPageIndex:function(){return this.start/this.count+1},setServiceUrl:function(t){this.searchServerUrl=t},getServiceUrl:function(){return this.searchServerUrl}},T.LocalSearchResult=function(t,i){this.result=t?t:{},this.obj=i?i:null,this.resultType="undefined"!=typeof this.result.resultType&&this.result.resultType,this.count="undefined"!=typeof this.result.count&&this.result.count,this.keyWord="undefined"!=typeof this.result.keyWord&&this.result.keyWord,this.pois="undefined"!=typeof this.result.pois&&this.result.pois,this.statistics="undefined"!=typeof this.result.statistics&&this.result.statistics,this.area="undefined"!=typeof this.result.area&&this.result.area,this.suggests="undefined"!=typeof this.result.suggests&&this.result.suggests,this.prompt="undefined"!=typeof this.result.prompt&&this.result.prompt,this.lineData="undefined"!=this.result.lineData&&this.result.lineData,this.pois&&(this.obj.countNumber=parseInt(this.count),this.obj.countPage=Math.ceil(this.obj.countNumber/this.obj.count))},T.LocalSearchResult.prototype={getResultType:function(){return this.resultType},getCount:function(){return this.count},getKeyword:function(){return this.keyWord},getPois:function(){return this.pois},getStatistics:function(){return this.statistics},getArea:function(){return this.area},getSuggests:function(){return this.suggests},getPrompt:function(){return this.prompt},getLineData:function(){return this.lineData},getLandMarkCount:function(){return this.landmarkcount}},T.Geocoder=function(){},T.Geocoder.prototype={getLocation:function(t,i){this.type=1,this.param="postStr";var e=t.getLng(),s=t.getLat();this.fun=i?i:null;var n="{";n+='"lon":"'+e+'",',n+='"lat":"'+s+'",',n+='"appkey":"8a7b9aac0db21f9dd995e61a14685f05",',n+='"ver":"1"}',this.ms(n)},getPoint:function(t,i){this.type=0,this.param="ds",this.fun=i?i:null;var e='{"keyWord":"'+t+'"}';this.ms(e)},ms:function(t){var i=T.ScriptLoader.getObject(),e=""!=T.tk?"&tk="+window.TMAP_AUTHKEY:"";i.load(T.w.R+encodeURIComponent(encodeURIComponent(T.w.E+"/geocoder?"+this.param+"="+t+"&type=geocode"+e)),"UTF-8",this,this.QD)},QD:function(t){this.result=t,this.lsResult=new T.GeocoderResult(this.result,this),this.fun&&this.fun(this.lsResult)}},T.GeocoderResult=function(t,i){this.result=t?t:null,this.resultObj=this.result.result?this.result.result:null,this.status=this.result.status?this.result.status:1,this.msg=this.result.msg?this.result.msg:null,this.location=this.resultObj&&this.resultObj.location?this.resultObj.location:null,null==this.location&&(this.location=this.result&&this.result.location?this.result.location:null),this.formatted_address=this.resultObj&&this.resultObj.formatted_address?this.resultObj.formatted_address:null,this.addressComponent=this.resultObj&&this.resultObj.addressComponent?this.resultObj.addressComponent:null},T.GeocoderResult.prototype={getStatus:function(){return parseInt(this.status)},getMsg:function(){return"ok"==this.msg?"OK":this.msg},getLocationPoint:function(){return this.location?new T.LngLat(this.location.lon,this.location.lat):null},getLocationLevel:function(){return this.location?this.location.level:null},getAddress:function(){return this.formatted_address},getAddressComponent:function(){return this.addressComponent?new T.AddressComponent(this.addressComponent):null}},T.AddressComponent=function(t){this.addressComponent=t?t:null,this.poi=this.addressComponent.poi?this.addressComponent.poi:null,this.road_distance=this.addressComponent.road_distance?this.addressComponent.road_distance:null,this.poi_distance=this.addressComponent.poi_distance?this.addressComponent.poi_distance:null,this.address_distance=this.addressComponent.address_distance?this.addressComponent.address_distance:null,this.address_position=this.addressComponent.address_position?this.addressComponent.address_position:null,this.address=this.addressComponent.address?this.addressComponent.address:null,this.road=this.addressComponent.road?this.addressComponent.road:null,this.poi_position=this.addressComponent.poi_position?this.addressComponent.poi_position:null,this.city=this.addressComponent.city?this.addressComponent.city:null},TMAP_TRANSIT_POLICY_LEAST_TIME=1,TMAP_TRANSIT_POLICY_LEAST_TRANSFER=2,TMAP_TRANSIT_POLICY_LEAST_WALKING=4,TMAP_TRANSIT_POLICY_AVOID_SUBWAYS=8,T.TransitRoute=function(t,i){this.jE=t,this.options=i?i:{},this.searchServerUrl=T.w.E,this.type="busline",i&&i.policy&&(this.policy=i.policy),i&&i.onSearchComplete&&(this.onSearchComplete=i.onSearchComplete),this.resultCode=null},T.TransitRoute.prototype={search:function(t,i){if(t&&i){this.postObj={},this.postObj.startposition=t.lng+","+t.lat,this.postObj.endposition=i.lng+","+i.lat,this.postObj.linetype=this.policy;var e=""!=T.tk?"&tk="+window.TMAP_AUTHKEY:"",s=T.w.R+encodeURIComponent(encodeURIComponent(this.searchServerUrl+"/transit?postStr="+JSON.stringify(this.postObj)+"&type="+this.type+e));this.query(s)}},query:function(t){var i=T.ScriptLoader.getObject();i.load(t,"UTF-8",this,this.callback)},callback:function(t){this.resultCode=t.resultCode,this.WD=new T.TransitRouteResult,this.WD.Ns(t),this.WD&&this.onSearchComplete&&this.onSearchComplete(this.WD)},setPolicy:function(t){this.policy=t},getResults:function(){return this.WD?this.WD:null},clearResults:function(){this.WD=null},setSearchCompleteCallback:function(t){this.onSearchComplete=t},getStatus:function(){return this.resultCode}},T.TransitRouteResult=function(){},T.TransitRouteResult.prototype={Ns:function(t){if(this._TransitRoutePlans=[],this.resultCode=t.resultCode,0!=this.resultCode)return!1;var i=t.results[0].lines;this.hasSubway=t.hasSubway,this.results=t.results[0];for(var e=0;e-1?this.SegmentType:null},getStationStart:function(){return this.StationStart?this.StationStart:null},getStationEnd:function(){return this.StationEnd?this.StationEnd:null},getSegmentLine:function(){return this.SegmentLine?this.SegmentLine:null}},T.TransitRoutePlan=function(){},T.TransitRoutePlan.prototype={getNumSegments:function(){return this.NumSegments?this.NumSegments:0},getDetails:function(t){return this._TransitRouteLines[t]?this._TransitRouteLines[t]:null},getLineName:function(){for(var t=this.LineName.split("|"),i=0;i-1?this.LineType:null}},T.BusLineSearch=function(t,i){this.jE=t,this.options=i?i:{},this.searchServerUrl=T.w.E,i&&i.onGetBusListComplete&&(this.onGetBusListComplete=i.onGetBusListComplete),i&&i.onGetBusLineComplete&&(this.onGetBusLineComplete=i.onGetBusLineComplete)},T.BusLineSearch.prototype={getBusList:function(t){if(this.jE){var i={};i.keyWord=t,i.level=""+this.jE.getZoom();var e=this.jE.getBounds();i.mapBound=e.getSouthWest().lng+","+e.getSouthWest().lat+","+e.getNorthEast().lng+","+e.getNorthEast().lat,i.queryType="1",i.start="0",i.count="10";var s="query",n="{";n=n+'"keyWord":"'+i.keyWord+'",',n=n+'"level":"'+i.level+'",',n=n+'"mapBound":"'+i.mapBound+'",',n=n+'"queryType":"'+i.queryType+'",',n=n+'"start":"'+i.start+'",',n=n+'"count":"'+i.count,n+='"}';var o=T.w.R+encodeURIComponent(encodeURIComponent(this.searchServerUrl+"/search?postStr="+n+"&type="+s+"&tk="+T.w.TMAP_AUTHKEY));this.query(o,this.wD)}},getBusLine:function(t){var i={};i.uuid=t.uuid;var e="busline",s=T.w.R+encodeURIComponent(encodeURIComponent(this.searchServerUrl+"/transit?postStr="+JSON.stringify(i)+"&type="+e));this.query(s,this.ED)},query:function(t,i){var e=T.ScriptLoader.getObject();e.load(t,"UTF-8",this,i)},wD:function(t){if(5==t.resultType){var i=new T.BusListResult;i.items=t.lineData,this.onGetBusListComplete&&this.onGetBusListComplete(i)}},ED:function(t){var i=new T.BusLine;i.init(t),this.onGetBusLineComplete&&this.onGetBusLineComplete(i)},setGetBusListCompleteCallback:function(t){this.onGetBusListComplete=t},setGetBusLineCompleteCallback:function(t){this.onGetBusLineComplete=t}},T.BusListResult=function(){},T.BusListResult.prototype={getBusListItem:function(t){var i={};return i.stationNum=this.items[t].stationNum,i.name=this.items[t].name,i.uuid=this.items[t].uuid,i},getNumBusList:function(){return this.items?this.items.length:0}},T.BusLine=function(){},T.BusLine.prototype={init:function(t){this.lineName=t.linename,this.lineType=t.linetype,this.length=t.length,this.linePoint=t.linepoint,this.startTime=t.starttime,this.endTime=t.endtime,this.totalTime=t.totaltime,this.stationCount=t.stationnum,this.interval=t.interval,this.ticketcal=t.ticketcal,this.totalPrice=t.totalprice,this.increasedPrice=t.increasedprice,this.increasedStep=t.increasedstep,this.ismonTicket=t.ismonticket,this.isBidirectional=t.isbidirectional,this.isManual=t.ismanual,this.status=0,this.company=t.company,this.station=t.station},getNumBusStations:function(){return this.station?this.station.length:0},getBusStation:function(t){return this.station[t]?this.station[t]:null},eD:function(t){for(var i=t.split(";"),e=[],s=0;s=parseInt(n[0])&&o<=h&&this.segmentNumberArr.push(this.routesItem[o])}else this.segmentNumberArr.push(this.routesItem[parseInt(this.segmentNumber)])},T.Route.prototype={getDescription:function(){return this.strguide},getNumSteps:function(){return this.segmentNumberArr.length},getStep:function(t){if("number"!=typeof this.segmentNumberArr[t]){var i=new T.Step(this.segmentNumberArr[t],this);return i}return null},getDistance:function(){for(var t=0,i=0;i