如何更改here.com javascript-api 中折线的颜色?

Jea*_*esi 2 javascript gis here-api

我在地图中绘制了多条折线,我希望它们根据某些事件更改其颜色...将折线对象添加到地图后是否有函数可以更改描边颜色属性?

Dr.*_*lle 5

使用setStyle- 方法:

polyline.setStyle( polyline.getStyle().getCopy({strokeColor:'Red'}));
Run Code Online (Sandbox Code Playgroud)

- 方法getCopy返回给定 SpatialStyle 的副本,其中 argument( {strokeColor:'Red'}) 的属性替换给定 SpatialStyle 的属性