Marker
此類表示地圖上一個圖像標注。
構造函數 | 描述 |
Marker(point: Point, opts: MarkerOptions) | 創建一個圖像標注實例。point參數指定了圖像標注所在的地理位置 |
方法 | 返回值 | 描述 |
openInfoWindow(infoWnd:InfoWindow) | none | 打開信息窗 |
closeInfoWindow() | none | 關閉信息窗 |
setIcon(icon: Icon) | none | 設置標注所用的圖標對象 |
getIcon() | Icon | 返回標注所用的圖標對象 |
setPosition(position: Point) | none | 設置標注的地理坐標 |
getPosition() | Point | 返回標注的地理坐標 |
setOffset(offset: Size) | none | 設置標注的偏移值 |
getOffset() | Size | 返回標注的偏移值 |
getLabel() | Label | 返回標注的文本標注 |
setLabel(label: Label) | none | 為標注添加文本標注 |
setTitle(title: String) | none | 設置標注的標題,當鼠標移至標注上時顯示此標題 |
getTitle() | String | 返回標注的標題 |
setTop(isTop: Boolean) | none | 將標注置于其他標注之上。默認情況下,緯度較低的標注會覆蓋在緯度較高的標注之上,從而形成一種立體效果。通過此方法可使某個標注覆蓋在其他所有標注之上。注意:如果在多個標注對象上調用此方法,則這些標注依舊按照緯度產生默認的覆蓋效果 |
enableDragging() | none | 開啟標注拖拽功能 |
disableDragging() | none | 關閉標注拖拽功能 |
enableMassClear() | none | 允許覆蓋物在map.clearOverlays方法中被清除 |
disableMassClear() | none | 禁止覆蓋物在map.clearOverlays方法中被清除 |
setZIndex(zIndex: Number) | none | 設置覆蓋物的zIndex |
getMap() | Map | 返回覆蓋物所在的map對象 |
addContextMenu(menu:ContextMenu) | none | 添加右鍵菜單 |
removeContextMenu(menu:ContextMenu) | none | 移除右鍵菜單 |
setAnimation(animation:Animation| Null) | none | 設置標注動畫效果。如果參數為null,則取消動畫效果。該方法需要在addOverlay方法后設置 |
setRotation(rotation: Number) | none | 設置點的旋轉角度 |
getRotation() | Number | 獲取點的旋轉角度 |
setShadow(shadow: Icon) | none | 設置標注陰影圖標 |
getShadow() | Icon | 獲取標注陰影圖標 |
addEventListener(event: String, handler: Function) | none | 添加事件監聽函數 |
removeEventListener(event: String, handler: Function) | none | 移除事件監聽函數 |
事件 | 參數 | 描述 |
click | event{type, target} | 點擊標注圖標后會觸發此事件 |
dblclick | event{type, target, point,pixel} | 雙擊標注圖標后會觸發此事件 |
mousedown | event{type, target, point,pixel} | 鼠標在標注圖上按下觸發此事件 |
mouseup | event{type, target, point,pixel} | 鼠標在標注圖上釋放觸發此事件 |
mouseout | event{type, target, point,pixel} | 鼠標離開標注時觸發此事件 |
mouseover | event{type, target, point,pixel} | 當鼠標進入標注圖標區域時會觸發此事件 |
remove | event{type, target} | 移除標注時觸發 |
infowindowclose | event{type, target} | 信息窗在此標注上關閉時觸發此事件 |
infowindowopen | event{type, target} | 信息窗在此標注上打開時觸發此事件 |
dragstart | event{type, target} | 開始拖拽標注時觸發此事件 |
dragging | event{type, target, pixel, point} | 拖拽標注過程中觸發此事件 |
dragend | event{type, target, pixel, point} | 拖拽結束時觸發此事件 |
rightclick | event{type, target} | 右鍵點擊標注時觸發此事件 |
MarkerOptions
此類表示Marker構造函數的可選參數。它沒有構造函數,但可通過對象字面量形式表示。
屬性 | 類型 | 描述 |
offset | Size | 標注的位置偏移值 |
icon | Icon | 標注所用的圖標對象 |
enableMassClear | Boolean | 是否在調用map.clearOverlays清除此覆蓋物,默認為true |
enableDragging | Boolean | 是否啟用拖拽,默認為false |
enableClicking | Boolean | 是否響應點擊事件。默認為true |
raiseOnDrag | Boolean | 拖拽標注時,標注是否開啟離開地圖表面效果。默認為false |
draggingCursor | String | 拖拽標注時的鼠標指針樣式。此屬性值需遵循CSS的cursor屬性規范 |
rotation | Number | 旋轉角度 |
shadow | Icon | 陰影圖標 |
title | String | 鼠標移到marker上的顯示內容 |