Constructor
new Geom(geometry, type)
覆盖物类
Parameters:
| Name | Type | Description |
|---|---|---|
geometry |
object | 原生的覆盖物类 |
type |
string | 覆盖物类型 |
- Source:
Methods
addMapEventListener(eventsOn, handler, context) → {function}
事件绑定,别名
Parameters:
| Name | Type | Description |
|---|---|---|
eventsOn |
* | 要注册的事件类型 |
handler |
function | 要调用的处理函数 |
context |
* | 处理程序的上下文 |
- Source:
Returns:
返回处理过的回调,用于移除绑定
- Type
- function
addTo(map, fitviewopt)
将覆盖物添加到默认图层
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
map |
object | map||layer 地图或图层对象,必传 | ||
fitview |
boolean |
<optional> |
false | 是否自动将地图设置为合适的中心并缩放覆盖物 |
- Source:
animate(styles, options, step)
覆盖物的动画声明(HTML覆盖物不支持)
Parameters:
| Name | Type | Description | |||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
styles |
* | 动画样式 | |||||||||||||||
options |
* | 动画选项
Properties
|
|||||||||||||||
step |
* | 动画步进过程中的回调,参数为当前动画状态 |
- Source:
animateCancel()
取消本次动画播放(如果有)并准备再次播放
- Source:
animateFinish()
完成动画播放(如果有),无法再播放
- Source:
animatePause()
暂停动画播放(如果有)
- Source:
animatePlay()
开始动画播放(如果有)
- Source:
animateShow(options, callback)
线,面类型的展开动画(声明后自动显示展开动画)
Parameters:
| Name | Type | Description | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
options |
* | 动画选项
Properties
|
|||||||||
callback |
* | 动画步进过程中的回调,参数为当前动画状态和当前动画步进坐标 |
- Source:
bringToBack() → {Geom}
将覆盖物放在后面(HTML覆盖物不支持)
- Source:
Returns:
修改后的覆盖物对象
- Type
- Geom
bringToFront() → {Geom}
将覆盖物放在顶部(HTML覆盖物不支持)
- Source:
Returns:
修改后的覆盖物对象
- Type
- Geom
closeInfoWindow()
关闭信息窗体
- Source:
createArcConnectorLineFeature(src, target, options) → {Geom}
曲线连接线
Parameters:
| Name | Type | Description | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
src |
Geom | 连接源覆盖物 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
target |
Geom | 目标覆盖物 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
options |
Object | 连接线配置项
Properties
|
- Source:
Returns:
- Type
- Geom
createCircleFeature(coordinates, radius, options) → {Geom}
创建圆形实例
Parameters:
| Name | Type | Description | ||||||
|---|---|---|---|---|---|---|---|---|
coordinates |
Array | 圆心;例如[-0.157049, 52.498568] | ||||||
radius |
number | 圆的半径,以米为单位 | ||||||
options |
object | 圆形配置项,同上
Properties
|
- Source:
Returns:
返回Geom实例
- Type
- Geom
createConnectorLineFeature(src, target, options) → {Geom}
直线连接线
Parameters:
| Name | Type | Description | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
src |
Geom | 连接源覆盖物 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
target |
Geom | 目标覆盖物 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
options |
Object | 连接线配置项
Properties
|
- Source:
Returns:
- Type
- Geom
createHtmlOverlay(coordinates, options) → {Geom}
创建HTMLElement实例
Parameters:
| Name | Type | Description | ||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
coordinates |
Array | 坐标 | ||||||||||||||||||||||||||||||||||||||||||
options |
Object | 配置项
Properties
|
- Source:
Returns:
返回Geom实例
- Type
- Geom
createIconFeature(position, options) → {Geom}
创建图标实例
Parameters:
| Name | Type | Description |
|---|---|---|
position |
Array | 点标记坐标 |
options |
object | 点标记配置项,同上 |
- Source:
Returns:
返回Geom实例
- Type
- Geom
createLableFeature(content, coordinates, width, height, options) → {Geom}
创建文本框实例
Parameters:
| Name | Type | Description | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
content |
String | 文字内容 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
coordinates |
Array | 中心点坐标 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
width |
Number | 像素宽度 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
height |
Number | 像素高度 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
options |
Object | 配置项
Properties
|
- Source:
Returns:
返回Geom实例
- Type
- Geom
createLineStringFeature(positions, options) → {Geom}
创建线类型实例
Parameters:
| Name | Type | Description | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
positions |
Array | 线覆盖物坐标集合,坐标要两个或两个以上;例如[[-0.131049, 51.498568],[-0.107049, 51.498568]] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
options |
object | 线覆盖物配置项
Properties
|
- Source:
Returns:
返回Geom实例
- Type
- Geom
createPointFeature(position) → {Geom}
创建点实例
Parameters:
| Name | Type | Description |
|---|---|---|
position |
Array | 点标记坐标 |
options.id |
Boolean | |
options.visible |
Boolean | 是否可见 |
options.editable |
Boolean | 是否可以编辑 |
options.interactive |
Boolean | 是否可以交互 |
options.cursor |
String | 鼠标悬停在几何上时的光标样式,与CSS中的定义相同 |
options.measure |
String | 坐标系,默认EPSG:4326 |
options.draggable |
Boolean | 是否可以拖动 |
options.dragShadow |
Boolean | 如果为true,则在拖动几何图形期间,将在移动几何图形之前拖动阴影 |
options.dragOnAxis |
Boolean | 如果设置,则只能沿指定的轴拖动几何,可能的值:x,y |
options.zIndex |
Number | 初始zIndex |
options.symbol |
Object | 点标记的默认符号 |
- Source:
Returns:
返回Geom实例
- Type
- Geom
createPolygonFeature(positions, options) → {Geom}
创建多边形实例
Parameters:
| Name | Type | Description | ||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
positions |
Array | 多边形坐标集合,坐标要三个或三个以上;例如[[-0.131049, 51.498568],[-0.107049, 51.498568],[-0.157049, 52.498568]] | ||||||||||||||||||||||||||||||||||||||||||||||||
options |
object | 多边形配置项
Properties
|
- Source:
Returns:
返回Geom实例
- Type
- Geom
createRectangleFeature(coordinates, width, height, options) → {Geom}
创建矩形实例
Parameters:
| Name | Type | Description |
|---|---|---|
coordinates |
Array | 矩形左上角坐标;例如[-0.157049, 52.498568] |
width |
number | 矩形宽度,以米为单位 |
height |
number | 矩形高度,以米为单位 |
options |
object | 矩形配置项,同上 |
- Source:
Returns:
返回Geom实例
- Type
- Geom
flash(intervalopt, countopt, cbopt, contextopt) → {Geom}
闪烁覆盖物图形
Parameters:
| Name | Type | Description |
|---|---|---|
intervalopt |
Number | 闪烁间隔,以毫秒为单位(毫秒) |
countopt |
Number | 闪烁次数 |
cbopt |
function | Flash结束时的回调函数 |
contextopt |
* | 上下文信息 |
- Source:
Returns:
覆盖物对象
- Type
- Geom
getCenter() → {Array}
获取对象地理中心坐标
- Source:
Returns:
返回坐标数组[x,y]
- Type
- Array
getContent() → {String}
获取html元素的内容
- Source:
Returns:
内容
- Type
- String
getCoordinates() → {Array}
获取覆盖物坐标
- Source:
Returns:
覆盖物的坐标
- Type
- Array
getHeight() → {*}
获取矩形高度(仅限矩形)
- Source:
Returns:
- Type
- *
getId() → {*}
获取覆盖物的ID。ID由setId或构造函数选项设置。
- Source:
Returns:
返回覆盖物ID
- Type
- *
getInfoWindow() → {*}
获取信息窗体实例
- Source:
Returns:
- Type
- *
getLayer() → {*}
返回该覆盖物所在图层
- Source:
Returns:
- Type
- *
getProperties() → {Object}
获取覆盖物属性(HTML覆盖物不支持)
- Source:
Returns:
覆盖物的属性
- Type
- Object
getRadius() → {Number}
获取圆的半径
- Source:
Returns:
圆形的半径
- Type
- Number
getSymbol()
获取覆盖物符号(HTML覆盖物不支持)
- Source:
getWidth() → {*}
获取矩形宽度(仅限矩形)
- Source:
Returns:
- Type
- *
getZIndex() → {Number}
获取覆盖物层级,默认是0(HTML覆盖物不支持)
- Source:
Returns:
- Type
- Number
hide() → {Geom}
隐藏覆盖物
- Source:
Returns:
覆盖物对象
- Type
- Geom
isVisible() → {boolean}
覆盖物是否可见
- Source:
Returns:
是否可见
- Type
- boolean
isVisible() → {Boolean}
覆盖物是否可见
- Source:
Returns:
- Type
- Boolean
on(eventsOn, handler, context) → {function}
事件绑定
Parameters:
| Name | Type | Description |
|---|---|---|
eventsOn |
* | 要注册的事件类型 |
handler |
function | 要调用的处理函数 |
context |
* | 处理程序的上下文 |
- Source:
Returns:
返回处理过的回调,用于移除绑定
- Type
- function
once(eventsOn, handler, context)
单次事件绑定,调用一次后移除
Parameters:
| Name | Type | Description |
|---|---|---|
eventsOn |
* | 要注册的事件类型 |
handler |
function | 要调用的处理函数 |
context |
* | 处理程序的上下文 |
- Source:
openInfoWindow(coordinate)
打开信息窗体
Parameters:
| Name | Type | Description |
|---|---|---|
coordinate |
Array | 可选,信息窗体打开的位置,例如[0,0],默认为覆盖物中心 |
- Source:
RemoveFeature()
从图层中删除自身(如果存在)
- Source:
removeInfoWindow()
移除信息窗体
- Source:
removeMapEventListener(eventsOn, handler, context)
事件移除,别名
Parameters:
| Name | Type | Description |
|---|---|---|
eventsOn |
* | 要移除的事件类型 |
handler |
function | 要移除的处理函数,该函数为绑定事件时返回的函数,如不传既移除该事件所有绑定(可选) |
context |
* | 处理程序的上下文 |
- Source:
setContent(content) → {Geom}
设置html元素的内容
Parameters:
| Name | Type | Description |
|---|---|---|
content |
String | HTMLElement |
- Source:
Returns:
覆盖物对象
- Type
- Geom
setCoordinates(array) → {Geom}
修改覆盖物坐标
Parameters:
| Name | Type | Description |
|---|---|---|
array |
Array | 覆盖物坐标 |
- Source:
Returns:
覆盖物对象
- Type
- Geom
setHeight(num) → {*}
设置矩形高度(仅限矩形)
Parameters:
| Name | Type | Description |
|---|---|---|
num |
* |
- Source:
Returns:
- Type
- *
setId(id)
设置覆盖物的ID
Parameters:
| Name | Type | Description |
|---|---|---|
id |
* |
- Source:
setInfoWindow(options)
设置信息窗体
Parameters:
| Name | Type | Description |
|---|---|---|
options |
* |
- Source:
setOptions(options) → {Geom}
设置覆盖物的options与默认options合并
Parameters:
| Name | Type | Description |
|---|---|---|
options |
Object | 覆盖物options |
- Source:
Returns:
覆盖物对象
- Type
- Geom
setProperties(properties) → {Geom}
为覆盖物设置新属性(HTML覆盖物不支持)
Parameters:
| Name | Type | Description |
|---|---|---|
properties |
Object | 覆盖物的新属性 |
- Source:
Returns:
修改后的覆盖物对象
- Type
- Geom
setRadius(num) → {Geom}
设置圆的半径
Parameters:
| Name | Type | Description |
|---|---|---|
num |
Number | 半径 |
- Source:
Returns:
圆形覆盖物对象
- Type
- Geom
setSymbol(symbol) → {Geom}
设置一个新符号以设置覆盖物样式(HTML覆盖物不支持)
Parameters:
| Name | Type | Description |
|---|---|---|
symbol |
Object | 新符号样式 |
- Source:
Returns:
返回修改后的覆盖物对象
- Type
- Geom
setWidth(num) → {*}
设置矩形宽度(仅限矩形)
Parameters:
| Name | Type | Description |
|---|---|---|
num |
* |
- Source:
Returns:
- Type
- *
setZIndex(num) → {Geom}
设置覆盖物层级(HTML覆盖物不支持)
Parameters:
| Name | Type | Description |
|---|---|---|
num |
Number |
- Source:
Returns:
覆盖物对象
- Type
- Geom
show() → {Geom}
显示覆盖物
- Source:
Returns:
覆盖物对象
- Type
- Geom
startDragFeatures()
开启拖拽
- Source:
startEditFeature()
开始编辑(HTML覆盖物不支持)
- Source:
stopDragFeatures()
结束拖拽
- Source:
stopEditFeature()
结束编辑(HTML覆盖物不支持)
- Source:
translate(x, y) → {Geom}
按给定的偏移量移动覆盖物(HTML覆盖物不支持)
Parameters:
| Name | Type | Description |
|---|---|---|
x |
Number | x偏移 |
y |
Number | y偏移 |
- Source:
Returns:
修改后的覆盖物对象
- Type
- Geom
un(eventsOn, handler, context)
事件移除
Parameters:
| Name | Type | Description |
|---|---|---|
eventsOn |
* | 要移除的事件类型 |
handler |
function | 要移除的处理函数,该函数为绑定事件时返回的函数,如不传既移除该事件所有绑定(可选) |
context |
* | 处理程序的上下文 |
- Source:
updateSymbol(symbol) → {Geom}
更新覆盖物图形的当前符号(HTML覆盖物不支持)
Parameters:
| Name | Type | Description |
|---|---|---|
symbol |
Object | 当前覆盖物图形已有的符号 |
- Source:
Returns:
返回修改后的覆盖物对象
- Type
- Geom