AreaLocation

GeoGlobe.Widget. AreaLocation

区域定位 只有2级节点

Constructor

new AreaLocation(id, options)

Example
var data = [{
            name: '南京市',
            center: [118.7785, 32.0435],
            zoom: '10',
            //父节点必填
            children: [{
                name: '玄武区1',
                center: [118.79, 32.05],
                zoom: '8',
            }, {
                name: '秦淮区2',
                center: [118.79, 32.04],
                zoom: '1',
            }, {
                name: '鼓楼区3asdas',
                center: [118.76, 32.07],
                zoom: '2',
            }, {
                name: '建邺区4sadsa',
                center: [118.73, 32.00],
                zoom: '4',
            }, {
                name: '建邺区5asdas',
                center: [118.73, 32.00],
                zoom: '',
            }, {
                name: '建邺区6sdsa',
                center: [118.73, 32.00],
                zoom: '',
            }, {
                name: '建邺区6asd ',
                center: [118.73, 32.00],
                zoom: '',
            }],
        }, {
            name: '南京市2sda ',
            center: [118.7785, 32.0435],
            zoom: '',
            //父节点必填
            children: [{
                name: '玄武区',
                center: [118.79, 32.05],
                zoom: '',
            }, {
                name: '秦淮区',
                center: [118.79, 32.04],
                zoom: '',
            }, {
                name: '鼓楼区',
                center: [118.76, 32.07],
                zoom: '',
            }, {
                name: '建邺区',
                center: [118.73, 32.00],
                zoom: '',
            }],
        }, {
            name: '南京市',
            center: [118.7785, 32.0435],
            zoom: '',
            //父节点必填
            children: [{
                name: '玄武区1',
                center: [118.79, 32.05],
                zoom: '',
            }, {
                name: '秦淮区2',
                center: [118.79, 32.04],
                zoom: '',
            }, {
                name: '鼓楼区3asdas',
                center: [118.76, 32.07],
                zoom: '',
            }, {
                name: '建邺区4sadsa',
                center: [118.73, 32.00],
                zoom: '',
            }, {
                name: '建邺区5asdas',
                center: [118.73, 32.00],
                zoom: '',
            }, {
                name: '建邺区6sdsa',
                center: [118.73, 32.00],
                zoom: '',
            }, {
                name: '建邺区6asd ',
                center: [118.73, 32.00],
                zoom: '',
            }],
        },]
        var opt = {
            //树结构数据
            data: data,
            //默认显示节点
            defaultName: '南京',
            //#area-location-panel
            direction:"",
            //点击的回调函数
            onClick: function (data) {
                
            }

        }
        var widget = new GeoGlobe.Widget.AreaLocation(
            'areaLocation-widget',
            opt
        );

        map.addWidget(widget, { top: 100, right: 100 });
Parameters:
Name Type Description
id String 创建的容器dom节点id
options Object options参数
Properties
Name Type Attributes Default Description
data Array 区域定位需要用到的数据
defaultName String <optional>
options.data[0].name 初始时显示的名字
direction String <optional>
bottom-right 面板朝向 其他的参数 top-left , top-right ,top-center, bottom-left , bottom-right,bottom-center 6个值
onClick function 点击节点的回调函数