Methods
判断图层是否存在
Name | Type | Description |
---|---|---|
layername |
string |
图层名称 |
Returns:
是否包含
创建图层
Name | Type | Description |
---|---|---|
style |
Object |
样式对象 |
name |
string |
图层名称 |
imageryLayerOptions |
Object |
图层配置 |
Returns:
异步返回图层对象
Example:
MVTMapManager.createLayer(style, 'layer1', { show:true, opacity:1 })
.then((layer) => {
viewer.imageryLayers.add(layer)
});
获取图层对象
Name | Type | Description |
---|---|---|
layername |
string |
图层名称 |
Returns:
图层对象
获取图层的当前样式数据
Name | Type | Description |
---|---|---|
layername |
string |
图层名称 |
Returns:
初始化矢量瓦片地图对象,也可以不主动调用, 在添加第一个图层的时候如果没有初始化,会自动初始化
Name | Type | Description |
---|---|---|
style |
Object |
样式对象 |
Returns:
Example:
MVTMapManager.initMVTManager(style)
拾取图层的数据
Name | Type | Description |
---|---|---|
ray |
Ray |
射线 |
scene |
Scene |
场景 |
layer |
string |
图层名称 |
Returns:
Example:
MVtMapManager.pickFeatures(ray, scene, 'layer1').then(function(features){
console.log(features)
})
移除图层
Name | Type | Description |
---|---|---|
layername |
string |
图层名称 |
viewer |
string |
地图对象 |
Returns:
是否成功
Example:
MVTMapManager.createLayer(style, 'layer1', { show:true, opacity:1 })
.then((layer) => {
viewer.imageryLayers.add(layer)
});
MVTMapManager.removeLayer('layer1', viewer)
设置图层的过滤条件
Name | Type | Description |
---|---|---|
layername |
string |
图层名称 |
filter |
Object |
过滤条件 |
subLayer |
string |
子图层名称,可选,如果不设置就对当前图层的所有子图层生效 |
Returns:
是否成功
Example:
MVTMapManager.setLayerFilter('layer1', ['>=', 'id', '2'],"layer1_sublayer1")
设置图层的显隐
Name | Type | Description |
---|---|---|
layername |
string |
图层名称 |
visible |
bool |
是否可见 |
Returns:
是否成功
Example:
MVTMapManager.setLayerVisible('layer1', true)
设置图层的布局属性
Name | Type | Description |
---|---|---|
layername |
string |
图层名称 |
property |
string |
属性名称 |
value |
Object |
属性值 |
subLayer |
string |
子图层名称,可选,如果不设置就对当前图层的所有子图层生效 |
Returns:
是否成功
Example:
MVTMapManager.setLayoutProperty('layer1', 'fill-color', "red")
设置图层的渲染属性
Name | Type | Description |
---|---|---|
layername |
string |
图层名称 |
property |
string |
属性名称 |
value |
object |
属性值 |
subLayer |
string |
子图层名称,可选,如果不设置就对当前图层的所有子图层生效* |
Returns:
是否成功
Example:
MVTMapManager.setLayerProperty('layer1', 'fill-color', "red")