为了让开发者获取更全面的全景信息,sdk提供以下方法供开发者调用:
1.2.0版本增加内景相册描述信息及全景点附近推荐信息数据获取;
2.1.0版本增加使用百度地图poiid(uid)获取全景信息及使用百度经纬度坐标(或墨卡托坐标)获取全景信息。
开发者可利用接口,根据内景id获取内景相册的描述信息,涉及到的接口为:
getpanoramabyiidwithjson(string iid),
实现的核心代码如下:
panoramarequest request =panoramarequest.getinstance(mcontext);request.getpanoramabyiidwithjson(iid);
通过上述接口可以获取内景的相册信息,内景相册demo就是这个接口获取的,具体可参照:
{"content":[{"interinfo":{"breakid":"01002200001308170737146415c","breakx":1292584839,"breaky":484668334,"d_icon":1,"d_street":1,"d_uii":1,"defaultfloor":0, --------------------- 默认楼层"entrances":[--------------------- 内景的入口点信息{"breakid":"01002200001308170737146415c","breakx":1292584839,"breaky":484668334,"entrancename":"大觉寺","isdefault":1,"marker":{"x":1292582800,"y":484668300},"uid":"465d2bc55c987ed7102935a0"}],"filetag":"inter_cfg","floors":[--------------------- 内景的楼层信息,以及楼层的单点信息{"floor":0,"imgheight":0,"imgwidth":0,"ltpoint":{"x":0,"y":0},"name":"floor_0","northdir":180,"points":[{"pid":"0300220000131105191740485in","timeline":"2013","x":1292581230,"y":484668209,"importance":0,"movedir":196,"name":"无量寿佛殿","northdir":180,"pin":0,"rank":1,"ugc":""},{"pid":"0300220000131105191733483in","timeline":"2013","x":1292581230,"y":484668209,"importance":0,"movedir":95,"name":"迦陵舍利塔","northdir":180,"pin":0,"rank":1,"ugc":""},{"pid":"0300220000131105191736484in","timeline":"2013","x":1292581230,"y":484668209,"importance":0,"movedir":260,"name":"大明敕谕碑","northdir":180,"pin":0,"rank":1,"ugc":""}],"scale":0,"startid":"0300220000131105191740485in"}],"hasimg":0,"iid":"465d2bc55c987ed7102935a0","ipoint":{"x":1292581200,"y":484668200},"imagetype":0,"name":"大觉寺","parent":"","type":"inter","uid":"465d2bc55c987ed7102935a0","vppoint":{"x":1292582800,"y":484668300},"vprank":586},"panoinfo":{"admission":"gs(2014)6066","date":"20131105","deviceheight":1.45,"enters":[],"filetag":"pano_cfg","heading":90,"id":"0300220000131105191740485in","imglayer":[{"blockx":2,"blocky":1,"imgformat":"jpg","imglevel":1},{"blockx":4,"blocky":2,"imgformat":"jpg","imglevel":2},{"blockx":8,"blocky":4,"imgformat":"jpg","imglevel":3},{"blockx":16,"blocky":8,"imgformat":"jpg","imglevel":4}],"inters":[{"breakid":"01002200001308170737146415c","floor":0,"iid":"465d2bc55c987ed7102935a0","name":"大觉寺"}],"layercount":4,"mode":"day","movedir":196,"northdir":180,"photos":[--------------------- 相册信息{"floor":0,"name":"无量寿佛殿","pid":"0300220000131105191740485in"},{"floor":0,"name":"迦陵舍利塔","pid":"0300220000131105191733483in"},{"floor":0,"name":"大明敕谕碑","pid":"0300220000131105191736484in"}],"pitch":0,"provider":4,"rname":"大觉寺","roll":0,"switchid":[],"time":"2013","type":"inter","version":"0","x":1292581230,"y":484668209,"z":0,"format_v":"0","plane":"","procdate":"20140922"}}],"result":{"error":0}}
开发者可利用接口,根据全景id获取服务推荐的附近的poi点的描述信息,涉及到的接口为:
getindoorpanoramarecommendinfo(string pid),
实现的核心代码如下:
panoramarequest request =panoramarequest.getinstance(mcontext);request.getpanoramarecommendinfo(string pid);
通过上述接口可以获取全景id的推荐的poi信息,具体可参照:
{"content":[{"dir":279.207, --------------视角朝向"info":"出口", --------------全景名称"pid":"01002200001308261445121685x", ------------全景pid"panox":12955228,"panoy":4817158,"pitch":0,"type":3,"uid":"","weigh":40,"x":12955203,"y":4817158},{"dir":337,"floor":1,"info":"美甲区","pid":"0300220000131231101751974in","pitch":0,"type":1,"weigh":15,"x":12955943,"y":4818040},{"dir":179,"floor":1,"info":"正门","pid":"0300220000131231101751975in","pitch":0,"type":1,"weigh":14,"x":12955943,"y":4818040},{"dir":0,"floor":2,"info":"大厅1","pid":"0300220000131231101751971in","pitch":0,"type":1,"weigh":10,"x":12955943,"y":4818040},{"dir":102,"floor":2,"info":"大厅2","pid":"0300220000131231101751972in","pitch":0,"type":1,"weigh":9,"x":12955943,"y":4818040},{"dir":61,"floor":2,"info":"包房","pid":"0300220000131231101751970in","pitch":0,"type":1,"weigh":9,"x":12955943,"y":4818040},{"dir":9,"floor":2,"info":"大厅等待区","pid":"0300220000131231101751973in","pitch":0,"type":1,"weigh":9,"x":12955943,"y":4818040}],"result":{"error":0}}
开发者可利用接口,根据百度地图poiid(uid)获取全景的描述信息,涉及到的接口为:getpanoramainfobyuid(string uid),
实现的核心代码如下(请在子线程中进行调用,具体可参考全景demo):
panoramarequest request =panoramarequest.getinstance(mcontext);string uid ="7c86f335bbcc18fc5fbe8669";baidupoipanodata poipanodata = request.getpanoramainfobyuid(string uid);//开发者可以判断是否有外景(街景)及内景poipanodata.hasstreetpano();poipanodata.hasinnerpano();
开发者可利用接口,根据百度经纬度坐标获取全景的描述信息,涉及到的接口为:getpanoramainfobylatlon(double longitude,double latitude),
实现的核心代码如下:
panoramarequest request =panoramarequest.getinstance(mcontext);double lat =40.029233;double lon =116.32085;baidupanodata locationpanodata = request.getpanoramainfobylatlon(lon,lat);//开发者可以判断是否有外景(街景)locationpanodata.hasstreetpano();
开发者可利用接口,根据墨卡托坐标获取全景的描述信息,涉及到的接口为:getpanoramainfobymercator(int x, int y),
实现的核心代码如下:
panoramarequest request =panoramarequest.getinstance(mcontext);int x =12948920;int y =4842480;baidupanodata locationpanodata = request.getpanoramainfobymercator(x,y);//开发者可以判断是否有外景(街景)locationpanodata.hasstreetpano();
注:以上接口涉及到网络请求,需要在独立线程中获取。
上一篇
下一篇
本篇文章对您是否有帮助?