MapMarker
Extends:
它用于显示地图上的可点击/拖拽的图标。 它支持这三种图标:Bootstrap 3 icons, Font Awesome 4.0, Semantic UI 0.9.8 icons, Ion Icons 2.0.1.
Example:
// example 1:
var myIcon = new KQ.Struct.Icon({
iconUrl: '../../images/custom-marker.png',
iconSize: [ 25, 41 ],
iconAnchor: [ 13, 40 ],
shadowUrl: '../../images/marker-shadow.png',
shadowSize: [ 25, 41 ],
shadowAnchor: [ 8, 40 ],
});
var marker = new KQ.Map.MapMarker([ 30, 104 ], { icon: myIcon });
marker.addToMapView(mapView);
// example 2:
var iconOptions = {
icon: 'fa-number',
markerColor: 'blue',
shape: 'square',
prefix: 'fa',
number: '3',
};
var marker = new KQ.Map.MapMarker([ 30.56, 113.66 ], {
extraIcon: iconOptions,
});
marker.addToMapView(mapView);
Constructor Summary
Public Constructor | ||
public |
constructor(latlng: LatLng, options: Object) 构造函数 |
Method Summary
Public Methods | ||
public |
addToMapView(mapview: Object, isAddDraw: Boolean): Null 添加标记到mapview |
|
public |
绑定弹出框 |
|
public |
bindTooltip(content: String | HTML, options: Object): MapMarker 绑定提示信息 |
|
public |
closePopup(): Null 关闭信息框 |
|
public |
getBounds(): * |
|
public |
弹出信息框 |
|
public |
remove(): Null 移除标记 |
|
public |
平滑移动标记 |
|
public |
unbindPopup(): Null 移除弹出框. |
|
public |
unbindTooltip(): Null 移除提示信息 |
Public Constructors
public constructor(latlng: LatLng, options: Object) source
构造函数
Params:
Name | Type | Attribute | Description |
latlng | LatLng | 地理坐标点 |
|
options | Object | 设置参数 |
|
options.icon | String | 用于渲染标记的icon的类名 |
|
options.extraIcon | Object | 用于生成新的图标。如果设置,options.icon将不会被使用了。 |
|
options.extraIcon.extraClasses | String | 在创建的<i>标签中额外增加的类 (fa-rotate90 myclass; space delimited classes to add) |
|
options.extraIcon.icon | String | 带有前缀的图标的名称 (fa-coffee or see icon library's documentation) |
|
options.extraIcon.unicode | String | 图标的unicode (fa-coffee or see icon library's documentation) |
|
options.extraIcon.iconColor | String | Icon的颜色 ('white', 'black' or css code, hex, rgba etc) |
|
options.extraIcon.innerHTML | String | 定制HTML (<svg>, images, or other HTML; a truthy assignment will override the default html icon creation behavior) |
|
options.extraIcon.markerColor | String | 标记的颜色 ('red', 'orange-dark', 'orange', 'yellow', 'blue-dark', 'cyan', 'purple', 'violet', 'pink', 'green-dark', 'green', 'green-light', 'black', or 'white') |
|
options.extraIcon.number | String | 不使用图标,而定义数字或字母 ('1' or 'A', must set icon: 'fa-number') |
|
options.extraIcon.prefix | String | icon库的基础类 (fa or see icon library's documentation) |
|
options.extraIcon.shape | String | 标记的形状 ('circle', 'square', 'star', or 'penta') |
|
options.extraIcon.zoomRate | String | 缩放比例 (建议:0.3~3.0) |
|
options.draggable | Boolean | 标记是否支持拖动 |
|
options.keyboard | Boolean | 标记是否支持键盘操作 |
|
options.title | String | 悬浮在标记上时的提示信息 |
|
options.alt | String | icon没有图像时的占位信息 |
|
options.opacity | String | 标记的透明度 |
|
options.label | String | 标签,支持html |
Emit:
click |
当用于单击时触发 |
dblclick |
当用于双击时触发 |
Public Methods
public openPopup(latlng: LatLng): Null source
弹出信息框
Params:
Name | Type | Attribute | Description |
latlng | LatLng | 目标位置(可选) |
Return:
Null |