如何更改google map api中方向线的颜色我检查了gdriection,但没有任何关于颜色这是我的代码
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;
}
谢谢
答案 0 :(得分:0)
在地图Google小组中查看此类似答案:https://groups.google.com/forum/?fromgroups#!topic/google-maps-api/-1yGOmMwd7I
在实例化GPolyLine
后,您似乎无法更改颜色,因此您需要构建两个GPolyLine
并在叠加层中添加/删除它们以显示不同的颜色。
如果不知道更好,一种方法是:
GDirections
构造函数传递给GMap
,因此不会添加。{li>
任何GPolyLine
s GLatLng
个顶点数组
GDirections.getVertex(index)
GPolyLine
不同的颜色GPolyLine
GMap2.addOverlay(GOverlay)