您当前的位置: Android全景SDK > 开发指南 > 全景描述信息
全景描述信息

全景描述信息

为了让开发者获取更全面的全景信息,SDK提供以下方法供开发者调用:

1.2.0版本增加内景相册描述信息及全景点附近推荐信息数据获取;

2.1.0版本增加使用百度地图POIID(uid)获取全景信息及使用百度经纬度坐标(或墨卡托坐标)获取全景信息。

利用内景ID获取内景的相册描述信息

开发者可利用接口,根据内景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获取服务推荐的描述信息

开发者可利用接口,根据全景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
    }
}

利用UID获取全景的描述信息

开发者可利用接口,根据百度地图POIID(uid)获取全景的描述信息,涉及到的接口为:getPanoramaInfoByUid(String uid),

实现的核心代码如下:

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();

注:以上接口涉及到网络请求,需要在独立线程中获取。