Class: VectorTileSubLayer

VectorTileSubLayer

new VectorTileSubLayer(options)

document/layer/baseLayer/VectorTileSubLayer.js, line 21

矢量瓦片子图层基类

Name Type Description
options Object

构造参数

Name Type Default Description
styleLayers Array.<Object> 可选

矢量瓦片子图层关联的矢量瓦片样式图层数组,只读属性

opacity Number 1 可选

子图层透明度

renderer BaseRenderer 可选

专题图渲染样式对象,支持如下渲染样式:
1、单值渲染
2、分段渲染
3、统一专题图

labelingInfo Array.<LabelClass> [] 可选

三维注记参数,仅当igs矢量瓦片图层labelsRenderMode设置非'off-screen'属性时生效。为性能考虑,当前所有子图层labelingInfo内labelClass必须保证renderMode一致,不支持同时设置label或canvas两种形式。

Extends

Members

capabilitiesObject

子图层支持能力。子图层支持能力分为客户端能力和服务端能力,其中客户端能力包含cesium、leaflet、mapboxgl引擎能力。默认子图层客户端能力:所有引擎能力都为空;默认子图层服务端能力为空。

图层版权信息

descriptionString

子图层描述信息

extendPropsObject

初始化当前图层对象上不支持的属性,二次开发用户希望挂在图层对像上的属性可以存储到该属性中

Default Value:
{}

extensionOptionsObject

初始化图层的额外参数,可以通过该参数传入引擎原生的构造参数

Default Value:
{}

extentExtent

子图层范围

idString

图层id,不给则生成随机id

labelingInfoArray.<LabelClass>

三维注记参数,仅当igs矢量瓦片图层labelsRenderMode设置非'off-screen'属性时生效。为性能考虑,当前所有子图层labelingInfo内labelClass必须保证renderMode一致,不支持同时设置label或canvas两种形式。

layerLayer

父图层对象。所有子图层(包含子图层的子图层)拥有同一个父图层对象。toJSON方法不会导出该属性。

maxScaleNumber

最大显示比例尺,图层在视图中可见的最大比例尺(最放大)。如果地图被放大到超过这个比例,图层将不可见。默认值为0,如果图层是瓦片类型,maxScale、minScale的默认值能和tileInfo上的保持一致,如果图层是动态图层,则和地图视图保持一致。maxScale应该始终小于minScale。

minScaleNumber

最小显示比例尺,图层在视图中可见的最小比例尺(最缩小)。如果地图被缩小到超过这个比例,图层将不可见。默认值为0,如果图层是瓦片类型,maxScale、minScale的默认值能和tileInfo上的保持一致,如果图层是动态图层,则和地图视图保持一致。minScale应该始终大于maxScale。

opacityNumber

矢量瓦片子图层透明度

Default Value:
1

原始图层的类型。目前有两种类型GroupLayer、SFeatureLayer。

parentSubLayer Layer null

父节点对象。toJSON方法不会导出该属性。

矢量瓦片子图层专题图渲染样式

spatialReferenceSpatialReference

空间参考系

styleLayersArray.<Object>

矢量瓦片子图层关联的矢量瓦片样式图层

sublayersCollection

包含的子图层对象

titleString

图层名称

图层类型

visibleBoolean

矢量瓦片子图层是否可见

Default Value:
true

Methods

VectorTileSubLayer.fromJSON(json)

document/layer/baseLayer/VectorTileSubLayer.js, line 293

通过json对象初始化该对象

Name Type Description
json Object

json对象

clone(){VectorTileSubLayer}

document/layer/baseLayer/VectorTileSubLayer.js, line 319

克隆图层对象

Returns:
Type Description
VectorTileSubLayer 克隆后的图层对象

inherited off(types, fn, context){Object}

base/Evented.js, line 328
Name Type Description
types string 可选

移除指定事件类型上绑定的回调函数
当类型为字符串时,可以移除单个或多个事件类型绑定的回调函数,单个事件:"click",多个事件:以空格分割:"click double-click";
当types为对象时,使用如下方式移除事件:{'click': onClickFun, 'mouse-move': onMouseMoveFun}

fn function 可选

事件回调函数,当types为字符串,且不指定要删除的回调函数时,删除该事件上的所有回调函数

context Object 可选

事件回调函数的this关键字将指向的对象

Returns:
Type Description
Object 当前实例
Examples

移除一个事件的指定回调函数

// 一个事件的回调函数
const clickFunction = function (event) {
  console.log("点击事件:", event)
}
// 调用MapView或SceneView的off方法移除一个事件的回调函数
view.off('click', clickFunction)

移除一个事件的所有回调函数

// 一个事件的回调函数1
const clickFunction1 = function (event) {
  console.log("点击事件1:", event)
}

// 一个事件的回调函数2
const clickFunction2 = function (event) {
  console.log("点击事件2:", event)
}

// 调用MapView或SceneView的off方法移除一个事件的所有回调函数
// 不指定回调函数,则移除该事件上的所有绑定的回调函数
view.off('click')

移除多个事件的同一个指定的回调函数

// 多个事件的同一个回调函数
const eventFunction = function (event) {
  console.log("事件:", event)
}
// 调用MapView或SceneView的off方法移除多个事件的同一个指定的回调函数
view.off('click double-click', eventFunction)

移除多个指定事件的回调函数

// 一个事件的回调函数
const clickFunction = function (event) {
  console.log("click事件:", event)
}
// 调用MapView或SceneView的off方法移除多个指定事件的回调函数
view.off({
   // 移除click事件上一个指定的函数
  "click": clickFunction,
  // 移除double-click上所有指定的函数
  "double-click": undefined
})

删除时指定上下文 - types类型为字符串

// 一个事件的回调函数
const clickFunction = function (event) {
  console.log("点击事件:", event)
}
// 调用MapView或SceneView的off方法移除一个事件的回调函数
view.off('click', clickFunction, view)
// 调用MapView或SceneView的off方法移除一个事件的所有回调函数
view.off('click', undefined, view)

删除时指定上下文 - types类型为对象

// 一个事件的回调函数
const clickFunction = function (event) {
  console.log("click事件:", event)
}
// 调用MapView或SceneView的off方法移除多个指定事件的回调函数
view.off({
   // 移除click事件上一个指定的函数
  "click": clickFunction,
  // 移除double-click上所有指定的函数
  "double-click": undefined
}, view)

inherited on(types, fn, context){Object}

base/Evented.js, line 232
Name Type Default Description
types String | Object null 可选

事件类型
当types为字符串时,可以定义单个或多个事件,单个事件:"click",多个事件:以空格分割:"click double-click";
当types为对象时,使用如下方式指定事件:{'click': onClickFun, 'mouse-move': onMouseMoveFun}

fn function null 可选

事件回调函数

context Object null 可选

事件回调函数的this关键字将指向的对象

Returns:
Type Description
Object 当前实例
Examples

注册一个事件

// 初始化一个点击事件回调函数
const clickFunction = function (event) {
  console.log("点击事件:", event)
}
// 调用MapView或SceneView的on方法注册一个点击事件
view.on('click', clickFunction)

一次注册多个事件 - 同一个回调函数

// 初始化一个事件回调函数
const eventFunction = function (event) {
  console.log("事件:", event)
}

// 调用MapView或SceneView的on方法注册多个事件
// 多个事件类型使用同一个回调函数
view.on('click right-click-down', eventFunction)

一次注册多个事件 - 分别指回调应函数

// 初始化一个左键点击事件回调函数
const clickFunction = function (event) {
  console.log("click事件:", event)
}

// 初始化一个右键按下事件回调函数
const rightClickFunction = function (event) {
  console.log("right-click-down事件:", event)
}

// 调用MapView或SceneView的on方法注册多个事件
// 每一个事件类型,使用单独的回调函数
// 注意使用此种方式,一种类型的事件仅能指定一个回调函数
view.on({
  "click": clickFunction,
  "right-click-down": rightClickFunction
})

指定上下文 - types类型为字符串

// 初始化一个点击事件回调函数
const clickFunction = function (event) {
  console.log("点击事件:", event)
  console.log("上下文对象:", this)
}
// 调用MapView或SceneView的on方法注册一个点击事件
// 指定view为回调函数的上下文对象
view.on('click', clickFunction, view)

指定上下文 - types类型为对象

// 初始化一个点击事件回调函数
const clickFunction = function (event) {
  console.log("点击事件:", event)
  console.log("上下文对象:", this)
}
// 调用MapView或SceneView的on方法注册一个点击事件
// 指定view为回调函数的上下文对象
view.on({
  "click": clickFunction,
  "right-click-down": clickFunction
}, view)

toJSON(){Object}

document/layer/baseLayer/VectorTileSubLayer.js, line 301

将图层转为json对象

Returns:
Type Description
Object json对象