多条折线 - 需要更改颜色

时间:2012-10-02 23:15:41

标签: colors polyline

我是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()); }
);

有人可以帮助我将此折线更改为任何其他颜色。

1 个答案:

答案 0 :(得分:0)

您可以尝试将direction.getPolyline()放入变量中,然后再将其添加为叠加层,然后在添加后调用GPolyline.setStrokeStyle(GPolyStyleOptions)。以下是GPolyline.setStrokeStyle()GPolyStyleOptions

的一些参考资料