# new IGSVectorTileSubLayer(options)
IGS矢量瓦片子图层
参数:
名称 | 类型 | 默认值 | 描述 |
---|---|---|---|
options |
Object | 构造参数 |
|
renderer |
BaseRenderer | 专题图渲染样式对象,支持如下渲染样式: |
|
id |
String | 矢量瓦片子图层的id,当加载MapGIS制作并由IGS发布的矢量瓦片时,如果矢量瓦片样式中有mapinfo参数,则子图层ID对应的是MapX中的图层索引; 如果没有mapinfo参数,则子图层ID对应的是矢量瓦片样式图层ID;当加载第三方发布的矢量瓦片时,子图层ID对应的是矢量瓦片样式图层ID; |
|
title |
String | 矢量瓦片子图层的标题 |
|
styleLayers |
Array.<Object> | 矢量瓦片子图层关联的矢量瓦片样式图层数组 |
|
visible |
Boolean | true | 图层可见性 |
layer |
IGSVectorTileLayer | 矢量瓦片父图层 |
|
labelingInfo |
Array.<LabelClass> | [] | 仅当IGSVectorTileLayer图层的labelsRenderMode参数设置非'off-screen'属性时生效 |
示例
// ES5引入方式
const { LabelClass } = zondy
const { IGSVectorTileLayer } = zondy.layer
// ES6引入方式
import { IGSVectorTileLayer, LabelClass } from "@mapgis/webclient-common"
// 初始化一个额外的图标DOM对象
const iconImage = new Image()
iconImage.src = '图片地址或者base64字符串'
// 初始化矢量瓦片图层
const igsVectorTileLayer = new IGSVectorTileLayer({
// 矢量瓦片基地址
url: '',
// 开启三维注记
labelsRenderMode: 'on-screen',
// 设置要应用三维主句的子图层
sublayers: [{
// 矢量瓦片子图层id
id: '矢量瓦片子图层id',
// 注记参数,目前仅用填写一个
labelingInfo: [
new LabelClass({
symbol: {
// 填充颜色 rgba or 16进制颜色
color: 'rgba(255,255,255,1)',
// 描边颜色
haloColor: 'rgba(0,0,0,0.5)',
// 描边宽度
haloSize: 2,
// 行高
lineHeight: 1.1,
// 文本间距
letterSpacing: 2,
// 字体样式 参考css
font: {
size: 14,
family: '微软雅黑',
weight: 'normal',
style: 'normal'
},
// 额外的图标
textExtraIcon: iconImage,
// 图标的大小
textExtraIconSize:20,
// 图标方位
textExtraIconAnchor:'left'
},
// 渲染方式 1.canvas 2.label 3.ground
renderMode: 'canvas',
// 最大可见范围
minScale: 60000000,
// 最小可见范围
maxScale: 1,
// 布局位置 可选 1.above-left 2.above-center 3.above-right 4.center-left 5.center-center 6.center-right 7.below-left 8.below-center 9.below-right
labelPlacement: 'above-center',
// 高程采样参数
elevationInfo: {
mode: 'OnTheGround',
offset: 0
}
})
]
}]
});
// ES5引入方式
const { LabelClass } = zondy
// ES6引入方式
import { LabelClass } from "@mapgis/webclient-common"
// 初始化一个额外的图标DOM对象
const iconImage = new Image()
iconImage.src = '图片地址或者base64字符串'
// 获取矢量瓦片子图层
const sublayer = igsVectorTileLayer.findSublayerById('子图层id')
// 设置一个新的矢量瓦片三维注记参数
sublayer.labelingInfo = [
new LabelClass({
symbol: {
// 填充颜色 rgba or 16进制颜色
color: 'rgba(1,255,1,1)',
// 描边颜色
haloColor: 'rgba(0,0,0,0.5)',
// 描边宽度
haloSize: 2,
// 行高
lineHeight: 1.1,
// 文本间距
letterSpacing: 2,
// 字体样式 参考css
font: {
size: 14,
family: '微软雅黑',
weight: 'normal',
style: 'normal'
},
// 额外的图标
textExtraIcon: iconImage,
// 图标的大小
textExtraIconSize:20,
// 图标方位
textExtraIconAnchor:'left'
},
// 渲染方式 1.canvas 2.label 3.ground
renderMode: 'canvas',
// 最大可见范围
minScale: 60000000,
// 最小可见范围
maxScale: 1,
// 布局位置 可选 1.above-left 2.above-center 3.above-right 4.center-left 5.center-center 6.center-right 7.below-left 8.below-center 9.below-right
labelPlacement: 'above-center',
// 高程采样参数
elevationInfo: {
mode: 'OnTheGround',
offset: 0
}
})
]
继承关系
成员变量
Array.<LabelClass>
# labelingInfo
三维注记参数,仅当igs矢量瓦片图层labelsRenderMode设置非'off-screen'属性时生效。为性能考虑,当前所有子图层labelingInfo内labelClass必须保证renderMode一致,不支持同时设置label或canvas两种形式。
- Inherited From:
方法
# static fromJSON(json)
通过json对象初始化该对象
参数:
名称 | 类型 | 描述 |
---|---|---|
json |
Object | json对象 |
IGSVectorTileSubLayer 新的IGSVectorTileSubLayer图层对象