Constructor
new MapUtil(maptalks, domRef, option)
- Description:
MapUtil类实例化函数
- Source:
Parameters:
Name | Type | Description |
---|---|---|
maptalks |
object | maptalks库的引用 |
domRef |
object | 地图要挂载的dom引用 |
option |
object | 地图配置 |
Methods
addGeometry(data, optionCb, targetLayer, infoWindowRef) → {Array.<object>}
- Description:
添加 geometry
- Source:
Parameters:
Name | Type | Description |
---|---|---|
data |
Array.<object> | 要渲染的数据 |
optionCb |
function | 数据 -> geometry配置 的函数(函数要返回一个数组,数组值的顺序是: geometry类型、生成geometry所需的参数(数组形式)、要监听的方法(可选)) |
targetLayer |
string | 目标layer id |
infoWindowRef |
object | infoWindow的渲染函数或者单文件组件的引用(使用组件中的 infowindowOption,来设置 infowindow,传入 closeInfoWindow 函数来控制显隐) |
Returns:
geometrys
- Type
- Array.<object>
addGeometryIns(geometryIns, targetLayer)
- Description:
添加 geometry 实例
- Source:
Parameters:
Name | Type | Description |
---|---|---|
geometryIns |
object | Array.<object> | geometry实例或实例数组 |
targetLayer |
string | 目标layer id |
addLayer(type, id, …args)
- Description:
添加图层
- Source:
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
type |
string | layer类型 |
|
id |
string | layer id 唯一 |
|
args |
any |
<repeatable> |
layer 需要的其它参数 |
Returns:
layer实例
destroy()
- Description:
销毁
- Source:
draw(mode, symbolOption) → {promise}
- Description:
绘制
- Source:
Parameters:
Name | Type | Description |
---|---|---|
mode |
string | 图形类型 |
symbolOption |
object | drawTool.symbol 的配置参数 |
Returns:
promise resolve 后返回绘制的 geometry 的相关信息
- Type
- promise
getGeometryInfo(geometry) → {object}
- Description:
获取 geometry 实例的相关信息
- Source:
Parameters:
Name | Type | Description |
---|---|---|
geometry |
object | geometry 实例 |
Returns:
geometry 的相关信息,area 面积(平方千米),length 长度(千米)
- Type
- object
init(domRef, option)
- Description:
初始化地图
- Source:
Parameters:
Name | Type | Description |
---|---|---|
domRef |
object | 地图要挂载的dom引用 |
option |
object | 地图配置 |
Returns:
地图实例
initDrawTool(symbol, option)
- Description:
初始化 drawTool
- Source:
Parameters:
Name | Type | Default | Description |
---|---|---|---|
symbol |
object |
null
|
symbol 配置 |
option |
object | drawTool 配置 |
toggleLayer(id, isShow)
- Description:
设置图层显隐
- Source:
Parameters:
Name | Type | Description |
---|---|---|
id |
string | 目标图层 id |
isShow |
boolean | 是否显示 |