1. HtmlPoint
1.1. 初始化 new HtmlPoint(options)
html点,该类是内部私有类,只能通过HtmlLayer的add方法进行创建并添加
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',默认为左击。 |
Example
let hp = htmlLayer.add(options)
1.2. 方法
1.2.1. HtmlPoint.zoomTo()
缩放至标签
Example
let hp = htmlLayer.add(options)
hp.zoomTo();
1.2.2. HtmlPoint.setPosition(position)
设置标签位置
Param | Type | Default | Description |
---|---|---|---|
position | Array.<number> |
经纬度和高度组成的数组 |
Example
let hp = htmlLayer.add(options)
hp.setPosition([113, 24, 50])
1.2.3. HtmlPoint.setVisible(visible)
设置标签显隐
Param | Type | Default | Description |
---|---|---|---|
visible | Boolean |
true为显示,false为隐藏 |
Example
let hp = htmlLlayer.add(options);
hp.setVisible(true);