1. HtmlLayer

Extends: Layer

1.1. 初始化 new HtmlLayer(options)

html图层,创建的是html元素的集合,通过add方法添加私有类HtmlPoint生成单个html元素点标签

Example

let geomap = new BOSGeo.GeoMap('bosgeoContainer'); //初始化
let htmlLayer = geomap.layerManager.createLayer(BOSGeo.LayerType.HTML, 'HTML')

1.2. 方法

1.2.1. htmlLayer.add(options) ⇒ HtmlPoint

添加标签

Param Type Default Description
options Object

配置选项

[options.name] String

名称。不设置则为undefined

options.position Array.<number>

位置。[longitude, latitude, height]

[options.html] HTMLDocument | String

html内容

[options.show] Boolean

是否显示

[options.autoShow] Boolean

是否需要自动在屏幕空间下进出显示隐藏

[options.nearFar] Number [0.0,1000000]

可见距离范围,默认为[0.0,100000]米。

[options.scaleByDistance] NearFarScalar | Array.<Number>

距离缩放配置,[near, nearValue, far, farValue],near-相机近距离,nearValue-近距离时的比例,near-相机远距离,nearValue-远距离时的比例,设置基于相机距离的缩放值,如[0, 1, 1.0e4, 0.0];

[options.onClick] function

点击数据图层后的回调函数

[options.clickType] function 'onclick'

点击事件类型,左击:'onclick',左双击:'ondbclick',默认为左击。

Returns :HtmlPoint -

Html点标签内部私有类,只能通过HtmlLayer的add方法创建

Example

let geomap = new BOSGeo.GeoMap('bosgeoContainer'); //初始化
let htmlLayer = geomap.layerManager.createLayer(BOSGeo.LayerType.HTML, 'HTML')
let p = htmlLayer.add({
    name: "事件撒点2",
    position: position2,
    html: `<div class='PointContainer2' style="width: 512px; height:256px;">
                <span class="pointText2">test2</span>
                <span class="pointIcon2"></span>
            </div>`,
    // clickType:'ondbclick',
    scaleByDistance: [0, 1, 1000, 0.0],
    onClick: () => {
        console.log('---click---')
    },
});

1.2.2. htmlLayer.remove(layer)

移除

Param Type Description
layer HtmlPoint

Html点标签内部私有类,HtmlLayer的add方法创建的返回值

Example

let geomap = new BOSGeo.GeoMap('bosgeoContainer'); //初始化
let htmlLayer = geomap.layerManager.createLayer(BOSGeo.LayerType.HTML, 'HTML')
let p = htmlLayer.add(options);
htmlLayer.remove(p);

1.2.3. htmlLayer.removeAll()

移除全部

Example

let geomap = new BOSGeo.GeoMap('bosgeoContainer'); //初始化
let htmlLayer = geomap.layerManager.createLayer(BOSGeo.LayerType.HTML, 'HTML')
let p = htmlLayer.add(options);
htmlLayer.removeAll();

1.2.4. htmlLayer.destroy()

销毁图层

Example

let geomap = new BOSGeo.GeoMap('bosgeoContainer'); //初始化
let htmlLayer = geomap.layerManager.createLayer(BOSGeo.LayerType.HTML, 'HTML')
let p = htmlLayer.add(options);
htmlLayer.destroy();
版权所有@盈嘉互联(北京)科技有限公司 京ICP备15051988号-9 Copyright © 2022 all right reserved,powered by Gitbook该文件修订时间: 2022-07-19 11:34:25

results matching ""

    No results matching ""