Constructor
new Map(containerID, options)
Parameters:
Name | Type | Description | ||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
containerID |
string | 容器 id, 可设置为空, 后续用init方法设置 |
||||||||||||||||||||||||||||||
options |
StateProperty | 地图初始化状态 Properties
|
Fires/事件:
Extends
Members
status
- 描述:
获取地图状态
获取地图状态
Methods
addControl(ctl) → {this}
- 描述:
添加控件
Parameters:
Name | Type | Description |
---|---|---|
ctl |
* |
Returns:
- Type
- this
addLayer(obj) → {this}
- 描述:
添加图层
Parameters:
Name | Type | Description |
---|---|---|
obj |
BaseLayer |
Returns:
- Type
- this
callWhenReady(cb) → {Map}
- 描述:
在地图准备好后触发
Parameters:
Name | Type | Description |
---|---|---|
cb |
function | 需要触发的任务 |
Returns:
this
- Type
- Map
clearLayer() → {this}
- 描述:
清空图层
Returns:
- Type
- this
createPattern(image, repetition) → {CanvasPattern}
- 描述:
创建填充图案
Parameters:
Name | Type | Description |
---|---|---|
image |
* | Image对象 |
repetition |
* | repeat / repeat-x / repeat-y / no-repeat |
Returns:
- Type
- CanvasPattern
destory()
- 描述:
销毁画布
dilute(coords, threshold) → {Array}
- 描述:
抽稀
Parameters:
Name | Type | Description |
---|---|---|
coords |
Array | 经纬度坐标,二维数组 |
threshold |
Number | 阈值 px |
Returns:
结果
- Type
- Array
fitView(bounds, scaleopt, optionsopt)
- 描述:
自适应区域
Parameters:
Name | Type | Attributes | Default | Description | |||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
bounds |
Array.<Array.<Array>> | 边界坐标 |
|||||||||||||||||||||||||||
scale |
Boolean |
<optional> |
false
|
是否缩放 |
|||||||||||||||||||||||||
options |
Object |
<optional> |
{}
|
选项 Properties
|
getActivateEditor() → {Object}
- 描述:
获取当前激活的编辑器对象
Returns:
- Type
- Object
getAllLayer() → {Array}
- 描述:
获取所有图层
Returns:
- Type
- Array
getLayer(id)
- 描述:
获取图层
Parameters:
Name | Type | Description |
---|---|---|
id |
* |
getProjection() → {Object}
- 描述:
获取当前坐标系
Returns:
- Type
- Object
init(containerID) → {Map}
- 描述:
初始化地图
Parameters:
Name | Type | Description |
---|---|---|
containerID |
string | 容器id |
Returns:
this
- Type
- Map
lngLat2px(lng, lat) → {Array}
- 描述:
经纬度转像素
Parameters:
Name | Type | Description |
---|---|---|
lng |
Number | |
lat |
Number |
Returns:
px
- Type
- Array
measureArea(coords) → {Number}
- 描述:
测量面积
Parameters:
Name | Type | Description |
---|---|---|
coords |
Array | 经纬度坐标 |
Returns:
平方米
- Type
- Number
measureRule(coords) → {Number}
- 描述:
测量距离
Parameters:
Name | Type | Description |
---|---|---|
coords |
Array | 经纬度坐标 |
Returns:
米
- Type
- Number
measureText(font, text) → {Number}
- 描述:
字体宽度
Parameters:
Name | Type | Description |
---|---|---|
font |
String | 字体样式 |
text |
String | 字体内容 |
Returns:
宽度
- Type
- Number
meter2px(m) → {Number}
- 描述:
米当前层级转换成像素
Parameters:
Name | Type | Description |
---|---|---|
m |
* |
Returns:
px
- Type
- Number
off(type, listener)
- 描述:
取消监听事件
- Overrides:
Parameters:
Name | Type | Description |
---|---|---|
type |
Array | string | 事件类型 |
listener |
function | 回调函数 |
on(type, listener, once)
- 描述:
绑定事件监听
- Overrides:
Parameters:
Name | Type | Description |
---|---|---|
type |
Array | string | |
listener |
function | 回调函数 |
once |
boolean | 一次 |
once(type, listener)
- 描述:
绑定一次事件监听
- Overrides:
Parameters:
Name | Type | Description |
---|---|---|
type |
Array | string | 事件类型 |
listener |
function | 回调函数 |
panBy(px, zoom, options) → {Object}
- 描述:
偏移像素
Parameters:
Name | Type | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
px |
Array | [x, y] |
||||||||||||
zoom |
Number | Null | 层级 |
||||||||||||
options |
Object | 选项 Properties
|
Returns:
当前动画对象, 可调用 stop()
- Type
- Object
panTo(center, zoom, options) → {Object}
- 描述:
移动到
Parameters:
Name | Type | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
center |
Array | 中心点 |
||||||||||||
zoom |
Number | Null | 层级 |
||||||||||||
options |
Object | 选项 Properties
|
Returns:
当前动画对象, 可调用 stop()
- Type
- Object
playback(options) → {Object}
- 描述:
动画播放
Parameters:
Name | Type | Description | ||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object |
Properties
|
Returns:
动画停止函数 { stop: function }
- Type
- Object
polygon_centroid(coords, intersect) → {Array}
- 描述:
多边形质心
Parameters:
Name | Type | Description |
---|---|---|
coords |
* | 坐标点 |
intersect |
boolean | 在屏幕可见部分计算 |
Returns:
- Type
- Array
polyline_centroid(coords, intersect) → {Array}
- 描述:
折线质心
Parameters:
Name | Type | Description |
---|---|---|
coords |
Array | 坐标点 |
intersect |
boolean | 在屏幕可见部分计算 |
Returns:
- Type
- Array
px2lngLat(x, y) → {Array}
- 描述:
像素转经纬度
Parameters:
Name | Type | Description |
---|---|---|
x |
Number | |
y |
Number |
Returns:
lnglat
- Type
- Array
px2meter(px) → {Number}
- 描述:
像素当前层级转换米
Parameters:
Name | Type | Description |
---|---|---|
px |
* |
Returns:
m
- Type
- Number
redraw()
- 描述:
重绘所有图层
refresh()
- 描述:
刷新所有图层
removeControl(ctl) → {this}
- 描述:
删除控件
Parameters:
Name | Type | Description |
---|---|---|
ctl |
* |
Returns:
- Type
- this
removeLayer(obj) → {this}
- 描述:
删除图层
Parameters:
Name | Type | Description |
---|---|---|
obj |
BaseLayer |
Returns:
- Type
- this
repeat(options) → {Object}
- 描述:
重复动画
Parameters:
Name | Type | Description | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object |
Properties
|
Returns:
动画停止函数 { stop: function }
- Type
- Object
resize()
- 描述:
重置画布大小
search(part) → {Array}
- 描述:
在范围内搜索覆盖物
Parameters:
Name | Type | Description | |||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
part |
Object |
Properties
|
Returns:
- Type
- Array
setLimitArea(bounds) → {this}
- 描述:
设置显示范围
Parameters:
Name | Type | Description |
---|---|---|
bounds |
Array | 边界坐标[[left,top],[right,bottom]] |
Returns:
- Type
- this
setMask(options) → {this}
- 描述:
设置遮罩
Parameters:
Name | Type | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object |
Properties
|
Returns:
- Type
- this
setSpatialReference(ref)
- 描述:
设置坐标系
Parameters:
Name | Type | Description | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
ref |
Object |
Properties
|
setZoom(zoom, options)
- 描述:
设置层级
Parameters:
Name | Type | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
zoom |
Number | 层级 |
||||||||||||
options |
Object | 选项 Properties
|
toDataURL() → {String}
- 描述:
导出图片
Returns:
- Type
- String
tryPickObj(x, y) → {Array}
- 描述:
拾取所有可拾取覆盖物
Parameters:
Name | Type | Description |
---|---|---|
x |
Number | |
y |
Number |
Returns:
- Type
- Array
zoomIn(step, options)
- 描述:
放大
Parameters:
Name | Type | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
step |
number | 层级 |
||||||||||||
options |
Object | 选项 Properties
|
zoomOut(step, options)
- 描述:
缩小
Parameters:
Name | Type | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
step |
number | 层次 |
||||||||||||
options |
Object | 选项 Properties
|
Events
blankfocus
- 描述:
空白处点击事件
Properties:
Name | Type | Description |
---|---|---|
type |
String | blankfocus |
target |
Map |
Type:
- Object
click
- 描述:
地图点击
Properties:
Name | Type | Description |
---|---|---|
type |
String | click |
target |
Map |
Type:
- Object
complete
- 描述:
地图加载完成
Properties:
Name | Type | Description |
---|---|---|
type |
String | complete |
target |
Map |
Type:
- Object
dblclick
- 描述:
地图双击
Properties:
Name | Type | Description |
---|---|---|
type |
String | dblclick |
target |
Map |
Type:
- Object
destory
- 描述:
地图销毁
Properties:
Name | Type | Description |
---|---|---|
type |
String | destory |
target |
Map |
Type:
- Object
move
- 描述:
地图移动
Properties:
Name | Type | Description |
---|---|---|
type |
String | move |
target |
Map |
Type:
- Object
out
- 描述:
移出地图
Properties:
Name | Type | Description |
---|---|---|
type |
String | out |
target |
Map |
Type:
- Object
over
- 描述:
移入地图
Properties:
Name | Type | Description |
---|---|---|
type |
String | over |
target |
Map |
Type:
- Object