簡體   English   中英

更改Google Map API V2的顏色

[英]changing color of google map api v2

我如何在檢查了gdriection的Google Map API中更改方向線的顏色,但是沒有任何關於顏色的內容,這是我的代碼

function direction() 
{
    var txtAddress = document.getElementById("<%=txtAddress.ClientID %>");

    var address = txtAddress.value;

    var TextBox1 = document.getElementById("<%=TextBox1.ClientID %>");

    var address1 = TextBox1.value;

    directions = new GDirections(map, directionsPanel);
    directions.load("from: " + address1 + " to: " + address + "");

  //  var address =txtAddress.value + "  " + TextBox3.value;

}

謝謝

在Google Maps網上論壇中看到以下類似答案: https : //groups.google.com/forum/?fromgroups#!topic/ google-maps-api/ -1yGOmMwd7I

實例化GPolyLine ,您似乎無法更改顏色,因此您需要構建兩個GPolyLine並從疊加中添加/刪除它們以顯示不同的顏色。

不知道有什么更好的辦法,那就是:

  1. 不要通過GDirections構造函數GMap ,因此它不會添加任何GPolyLine
  2. GDirections.getVertex(index)構建一個GLatLng頂點數組
  3. 用不同的顏色構建自己的GPolyLine
  4. 使用GMap2.addOverlay(GOverlay)在地圖上覆蓋GPolyLine

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM