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