Polyline
使用瀏覽器的矢量制圖工具(如果可用)在地圖上繪制折線的地圖疊加層。
構(gòu)造函數(shù) | 描述 |
Polyline(points: Array< Point>, opts: PolylineOptions) | 創(chuàng)建折線覆蓋物對象 |
方法 | 返回值 | 描述 |
setPath(path: Array< Point>) | none | 設(shè)置折線的點數(shù)組 |
getPath() | Array<Point> | 返回折線的點數(shù)組 |
setStrokeColor(color: String) | none | 設(shè)置折線的顏色 |
getStrokeColor() | String | 返回折線的顏色 |
setStrokeOpacity(opacity: Number) | none | 設(shè)置透明度,取值范圍0 - 1 |
getStrokeOpacity() | Number | 返回透明度 |
setStrokeWeight(weight: Number) | none | 設(shè)置線的寬度,范圍為大于等于1的整數(shù) |
getStrokeWeight() | Number | 返回線的寬度 |
setStrokeStyle(style: String) | none | 設(shè)置是為實線或虛線,solid或dashed |
getStrokeStyle() | String | 返回當(dāng)前線樣式狀態(tài),實線或者虛線 |
getBounds() | Bounds | 返回覆蓋物的地理區(qū)域范圍 |
enableEditing() | none | 開啟編輯功能 |
disableEditing() | none | 關(guān)閉編輯功能 |
enableMassClear() | none | 允許覆蓋物在map.clearOverlays方法中被清除 |
disableMassClear() | none | 禁止覆蓋物在map.clearOverlays方法中被清除 |
setPositionAt(index: Number, point: Point) | none | 修改指定位置的坐標(biāo)。索引index從0開始計數(shù)。例如setPointAt(2, point)代表將折線的第3個點的坐標(biāo)設(shè)為point |
getMap() | Map | 返回覆蓋物所在的map對象 |
addEventListener(event: String, handler: Function) | none | 添加事件監(jiān)聽函數(shù) |
removeEventListener(event: String, handler: Function) | none | 移除事件監(jiān)聽函數(shù) |
事件 | 參數(shù) | 描述 |
click | event{type, target, point, pixel} | 點擊折線后會觸發(fā)此事件 |
dblclick | event{type, target, point, pixel} | 雙擊折線后會觸發(fā)此事件 |
mousedown | event{type, target, point, pixel} | 鼠標(biāo)在折線上按下觸發(fā)此事件 |
mouseup | event{type, target, point, pixel} | 鼠標(biāo)在折線釋放觸發(fā)此事件 |
mouseout | event{type, target, point, pixel} | 鼠標(biāo)離開折線時觸發(fā)此事件 |
mouseover | event{type, target, point, pixel} | 當(dāng)鼠標(biāo)進(jìn)入折線區(qū)域時會觸發(fā)此事件 |
remove | event{type, target} | 移除折線時觸發(fā) |
lineupdate | event{type, target} | 覆蓋物的屬性發(fā)生變化時觸發(fā) |
PolylineOptions
此類表示Polyline構(gòu)造函數(shù)的可選參數(shù)。它沒有構(gòu)造函數(shù),但可通過對象字面量形式表示。
屬性 | 類型 | 描述 |
strokeColor | String | 折線顏色 |
strokeWeight | Number | 折線的寬度,以像素為單位 |
strokeOpacity | Number | 折線的透明度,取值范圍0 - 1 |
strokeStyle | String | 折線的樣式,solid或dashed |
enableMassClear | Boolean | 是否在調(diào)用map.clearOverlays清除此覆蓋物,默認(rèn)為true |
enableEditing | Boolean | 是否啟用線編輯,默認(rèn)為false |
enableClicking | Boolean | 是否響應(yīng)點擊事件,默認(rèn)為true |