0

我是 Google 地图的新手 - 我正在尝试更改地图上第二条折线的颜色。

这是我目前所拥有的~

var direction = new GDirections(); 

direction.load("from: Oregon 99, near, Halsey, Oregon to: Oregon 34, near, Tangent, Oregon to: Interstate 5, near, Tigard, Oregon to: Oregon 217, near, Cedar Hills, Oregon to: U.S. 26, near, North Plains, Oregon to: U.S. 26, near, Tigard, Oregon to: Interstate 405, near, Portland, Oregon to: Interstate 5, near, Vancouver, Wa to: Interstate 5, near, Carrolls, Wa to: Washington 432,  near, Longview, Wa to: Washington 433, near, Rainier, Oregon to: U.S. 30, Wauna, Oregon", {getPolyline:true});

GEvent.addListener(direction, 
                   "load", 
                   function(){ map.addOverlay(direction.getPolyline()); }
);

有人能帮我把这条折线改成其他颜色吗?

4

1 回答 1

0

您可以尝试direction.getPolyline()在将其添加为覆盖之前放入一个变量,然后在添加它之后调用GPolyline.setStrokeStyle(GPolyStyleOptions)它。以下是GPolyline.setStrokeStyle()GPolyStyleOptions的一些参考资料

于 2012-10-03T08:39:04.300 回答