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

How can I change the color of a polyline in here.com javascript-api?

我在地图中绘制了多条多段线,我希望它们根据某些事件更改颜色...添加多段线对象后是否有更改描边颜色的功能属性到地图?

使用setStyle-方法:

polyline.setStyle( polyline.getStyle().getCopy({strokeColor:'Red'}));

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

的属性