Polygons

Polyline class

google.maps.Polyline class

折線是地圖上連接線段的線性疊加層。

這個類別會擴充 MVCObject

撥打 const {Polyline} = await google.maps.importLibrary("maps") 即可存取。
請參閱「Maps JavaScript API 中的程式庫」。

Polyline
Polyline([opts])
參數: 
使用傳遞的 PolylineOptions 建立折線,指定折線路徑和繪製折線時使用的筆劃樣式。建構折線時,您可以傳遞 LatLng 陣列或 LatLngMVCArray,但簡單陣列會在例項化時轉換為折線內的 MVCArray
getDraggable
getDraggable()
參數:
傳回值:  boolean
傳回使用者是否可以拖曳這個形狀。
getEditable
getEditable()
參數:
傳回值:  boolean
傳回使用者是否可編輯這個形狀。
getMap
getMap()
參數:
傳回值:  Map|null
傳回附加這個形狀的地圖。
getPath
getPath()
參數:
傳回值:  MVCArray<LatLng>
擷取路徑。
getVisible
getVisible()
參數:
傳回值:  boolean
傳回這個多邊形是否在地圖上顯示。
setDraggable
setDraggable(draggable)
參數: 
  • draggableboolean
傳回值:
如果設為 true,使用者可以將這個形狀拖曳到地圖上。geodesic 屬性會定義拖曳模式。
setEditable
setEditable(editable)
參數: 
  • editableboolean
傳回值:
如果設為 true,使用者可以拖曳頂點和每個線段上顯示的控制點,編輯這個形狀。
setMap
setMap(map)
參數: 
  • mapMap optional
傳回值:
在指定地圖上轉譯這個形狀。如果地圖設為 null,系統會移除形狀。
setOptions
setOptions(options)
參數: 
傳回值:
setPath
setPath(path)
參數: 
傳回值:
設定路徑。詳情請參閱 PolylineOptions
setVisible
setVisible(visible)
參數: 
  • visibleboolean
傳回值:
如果設為 false,則會隱藏這個多邊形。
已繼承: addListenerbindTogetnotifysetsetValuesunbindunbindAll
click
function(event)
引數: 
折線引發 DOM click 事件時,會引發此事件。
contextmenu
function(event)
引數: 
在 Polyline 上觸發 DOM contextmenu 事件時,會觸發這個事件。
dblclick
function(event)
引數: 
折線引發 DOM dblclick 事件時,會引發此事件。
drag
function(event)
引數: 
使用者拖曳折線時,系統會重複觸發這個事件。
dragend
function(event)
引數: 
使用者停止拖曳折線時,系統會觸發這個事件。
dragstart
function(event)
引數: 
使用者開始拖曳折線時,系統會觸發這個事件。
mousedown
function(event)
引數: 
折線引發 DOM mousedown 事件時,會引發此事件。
mousemove
function(event)
引數: 
折線引發 DOM mousemove 事件時,會引發此事件。
mouseout
function(event)
引數: 
折線 mouseout 會引發此事件。
mouseover
function(event)
引數: 
折線 mouseover 會引發此事件。
mouseup
function(event)
引數: 
折線引發 DOM mouseup 事件時,會引發此事件。
rightclick
function(event)
引數: 
以滑鼠右鍵按一下折線時,會引發此事件。

PolylineOptions 介面

google.maps.PolylineOptions 介面

PolylineOptions 物件,用於定義可在 Polyline 上設定的屬性。