标记
地图标记是将信息标注到地图上显示,便于查看。
示例代码:
Indoor.marker([50.5, 30.5]).addTo(map);
创建标记
Factory |
Description |
---|---|
Indoor.marker( <LatLng> latlng,<Marker options> options? ) |
对给定的地理点标记对象. |
标记选项
Option |
Type |
Default |
Description |
---|---|---|---|
icon |
Indoor.Icon |
* |
标记图标. |
draggable |
Boolean |
false |
是否可以拖拽. |
title |
String |
” |
tip文本. |
alt |
String |
” |
alt文本. |
zIndexOffset |
Number |
0 |
z-index 增加一个数值. |
opacity |
Number |
1.0 |
不透明度. |
riseOnHover |
Boolean |
false |
鼠标移动到标记后是否往上升. |
地图事件
通过这些方法来订阅地图事件。
Event |
Data |
Description |
---|---|---|
click |
MouseEvent |
单击. |
dblclick |
MouseEvent |
双击. |
mousedown |
MouseEvent |
鼠标按下. |
mouseover |
MouseEvent |
鼠标移动到标记. |
mouseout |
MouseEvent |
鼠标离开标记. |
contextmenu |
MouseEvent |
鼠标右键点击标记. |
dragstart |
Event |
开始拖动标记. |
drag |
Event |
标记拖动过程. |
dragend |
DragEndEvent |
拖动结束. |
move |
Event |
标记移动. |
add |
Event |
添加标记到地图. |
remove |
Event |
从地图上删除标记. |
标记方法
Method |
Returns |
Description |
---|---|---|
addTo( <Map> map ) |
this |
添加标记到地图. |
getLatLng() |
LatLng |
获取标记的坐标. |
setLatLng( <LatLng> latlng ) |
this |
设置标记的坐标. |
setIcon( <Icon> icon ) |
this |
设置标记的图标. |
setZIndexOffset( <Number> offset ) |
this |
改变标记的z-index |
bindPopup( <String> html | <HTMLElement> el | <Popup> popup, <Popup options> options? ) |
this |
绑定标记信息窗体. |
unbindPopup() |
this |
解除绑定信息窗体 |
openPopup() |
this |
打开先前绑定的信息窗体 |
getPopup() |
Popup |
返回先前由绑定的信息窗体 |
closePopup() |
this |
关闭标记 |
setPopupContent( <String> html | <HTMLElement> el ) |
this |
设置此标记的信息窗体的HTML内容. |